Share via


VBA String Editor

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The VBA String Editor add-in assists in the formatting of strings for inclusion in Microsoft® Visual Basic® for Applications (VBA) code. Complex strings, such as SQL statements, can be entered as standard text, and the String Editor will format the string with the proper quotation marks and other symbols and insert it into your code.

Using the VBA String Editor reduces the time developers spend building strings and hunting syntax errors by making it easier to create strings, such as when embedding long scripts or complicated SQL statements into VBA code.

To open the VBA String Editor add-in, open the Visual Basic Editor (ALT + F11) from any Office application. If the VBA String Editor tool is not listed in the Add-Ins menu, you must first load it, using the Add-In Manager located in the Add-Ins menu. When the tool is loaded, you can launch it from the Add-Ins menu. To load the VBA String Editor add-in into the Add-In Manager, select the add-in, and then check the Loaded/Unloaded check box.

  • String Design Surface
    Enter a string to be formatted in this area.

  • String Edit Mode Toggle Toolbar Button
    Toggles between String and NonString for new text and selected text. When in NonString (variable) format, text appears in blue. Words in blue text will be interpreted as variables upon updating.

  • Concatenation Symbol Toolbar Button
    Toggles between the "&" and the "+" concatenation symbols for the selected text.

    Note   Although either symbol will work as a concatenation operator, the "+" symbol is used as an addition operator also. If a string contains numerical characters, the "+" symbol will causes those numbers to be added together rather than displayed as a string. For best results, always use the "&" symbol when you want to concatenate strings.

  • Cut
    Makes it possible for you to cut text.

  • Copy
    Makes it possible for you to copy text from the VBA String Editor.

  • Paste
    Makes it possible for you to paste text to the VBA String Editor.

Keyboard Shortcuts

The following keyboard shortcuts are available in the VBA String Editor:

Command Shortcut
Cut CTRL + X
Copy CTRL + C
Paste CTRL + V
String Edit Mode Toggle CTRL + T
Concatenation Symbol Toggle CTRL + S
Help F1

See Also

Office Developer Productivity Tools | Office Developer Productivity Tools Add-In Manager | Multi-Code Import/Export Add-In | Code Commenter and Error-Handler Add-In | VBA Source Control | Working with String Variables