Code Library

Top  Previous  Next

 VS   VB6   VB5   VBA 

The Code Library feature allows you to have a repository of code templates that you insert frequently in your source code. The code templates are created in the Options window, Team Options or Personal Options tabs, Code Library section. When you invoke this feature, the Code Library toolwindow is shown:


MZ-Tools offers the following ways to show the Code Library toolwindow:

  • The MZ-Tools | Code Library menu.
  • The Code Library button on the MZ-Tools - Main toolbar.
  • In Visual Studio, the keyboard shortcut associated with the MZTools8.CodeLibrary command.
  • In VB6 / VB5 / VBA, the keyboard shortcut associated with the Code Library feature.

The Code Library toolwindow allows you to search code templates with some letters in the description.

In addition, you can associate a customized keyboard shortcut to each code template that inserts directly the code template into the source code without using the Code Library toolwindow.

You can also insert code templates through expansion keywords (a short word that you type in the code window when you want to insert its associated code template). To use this functionality:

  • In Visual Studio, associate a customized keyboard shortcut to the MZTools8.ExpandKeyword command (see Keyboard Shortcuts Options).
  • In VB6 / VB5 / VBA, associate a keyboard shortcut associated with the Expand Keyword feature (see Keyboard Shortcuts Options):


  • Associate an expansion keyword to the code template.
  • Type the expansion keyword in a text file and press the keyboard shortcut created in the first step. If the keyword is recognized, it will be replaced by the associated template.

Code templates can include:

  • Predefined variables (such as the author, current date, method name, cursor position after insertion, etc.).
  • User-defined variables, that is, your own variables. When you insert in the source code a code template with user-defined variables, a window asks you the values of those variables.

See Also:

Team Code Library Options

Personal Code Library Options

Keyboard Shortcuts Options

Predefined Variables

User-defined Variables