Bracket Autocompletion

In VBA, every opening bracket must be followed by a closing bracket at a later point. The only exception to this is when the opening bracket forms part of a string. VbaPrime helps you by automatically adding the closing bracket after you type an opening bracket, then places the cursor between the two brackets.


Because VbaPrime automatically adds the closing bracket and moves the cursor between the two brackets, you don't have to interrupt your train of thought to close the bracket, then go back and type the code you intended. Nor do you have to remember to type the closing bracket once you have finished your statement.


The following animation demonstrates VbaPrime automatically adding closing brackets. It then also demonstrates code highlighting when you type over a closing bracket.


Perform the following steps to see VbaPrime's bracket handling ability:

  1. Open the Visual Basic Editor (VBE) and double-click on a module to open up its code window.
  2. Type Sub MySub() into the code window and then press enter. The VBE will automatically add the End Sub statement.
  3. Type a = (. VbaPrime will automatically add the closing bracket.
  4. Type funcCall(, as if calling a function. VbaPrime will automatically add another closing bracket.
  5. Now type 1+2. This code will appear between the two brackets of the function call.
  6. Without moving the cursor, type a closing bracket.
    • So that you don't get too many brackets, VbaPrime will write over the existing bracket.
    • .
    • VbaPrime will also briefly highlight code enclosed by this closing bracket and its corresponding opening bracket.

Double Quotes

Note that if you type an opening bracket inside double-quotes, VbaPrime will detect that it is in a string and not add the closing quote.