Setting VBA/VB6 Module Coding Standards in Total Visual CodeTools

The Standards section of Total Visual CodeTools lets you specify the settings that apply across the Code Builders, Code Cleanup, and Code Delivery features. These settings are saved to a file which can be shared across machines and developers. You can even password protect the settings to enforce your standards across your team.

Available under the Standards menu item or the Standards button on most tools, the settings are organized into these sections:


The Builder Settings specify the general options for the Code Builders.

Builder Standards in Total Visual CodeTools for VB6 and VBA/Office

These options are available:

  • The number of spaces for each indentation (defaults to your VB6/VBA editor setting)
  • For word-wrapping, the maximum number of characters in each line, and the use of line continuation character ( _) at the end of the line
  • An external editor, if any. The builders can send its code to the project at the current cursor position, the clipboard so you can paste it later, a file on disk, or to an external editor like Notepad.
  • Menu location to specify whether Total Visual CodeTools appears at the top menu bar or under the Add-ins or Tools menus.

The Cleanup Style settings are used with the Code Cleanup feature. When you specify the Cleanup Style option under Code Cleanup, the selections here determine how the VB6/VBA code is modified.

Code Cleanup Standards in Total Visual CodeTools for VB6 and VBA/Office

These options are available:

  • Standardizing line indentations. If a line contains multiple lines of code separated by colons, they are split into individual lines
  • Split single line IF statements into multiple lines with END IF.
  • Split single line declarations (Dim statements) into multiple lines
  • Specify the number of blank lines between procedures
  • Specify the maximum number of blank lines within your code
  • Sort your procedures. For instance, you can have Public procedures above your private ones

For examples of how these settings are applied, see the Sample Code Cleanup.

The commenting section is divided into six tabs:

  • The General tab for settings that apply to all the commenting options
  • Code Cleanup commenting options:
    • Cleanup Mod for comments to add in the General Declarations section of modules (can include procedure lists of the module)
    • Cleanup Proc for the comments to add to procedures
    • Cleanup Prop for the comments to add to properties
  • New Proc for the comments to add in the New Procedure Builder
  • New Prop for the comments to add in the New Property Builder

Commenting Standards in Total Visual CodeTools for VB6 and VBA/Office

The General Tab options are:

  • Your name and initials which can be referenced in the comments
  • The comment string to be used in the Block Commenter feature
  • Whether to place procedure comments before or after the Sub/Function line
  • How date and time references should be formatted

The other tabs let you specify your comment structure with the use of tokens to reference the module name, procedure lists, procedure name, procedure type, your initials, the current date/time, etc.

Here's an example of the Cleanup Module tab with the list of Token Definitions displayed. When Code Cleanup adds this to a module, the #M# token is replaced with that module's name, #V# is replaced with the list of procedures in the module, #D# with the current date, and #I# with the developer's initials.

Commenting Tokens in Total Visual CodeTools for VB6 and VBA/Office

For the New Procedure tab, there are separate comment structures for Functions vs. Subs:

Commenting Standards for New Procedures in Total Visual CodeTools for VB6 and VBA/Office

Here's more information on the New Procedure Builder.

Similar to commenting, you can specify your own error handler to apply to different situations. The Error Handling section is divided into four tabs.

The first tab is Cleanup Options for Code Cleanup if you choose to add error handling to procedures that lack it. Here you can optionally determine if you want to add error handling to property procedures (Let, Get, and Set), and determine if you want to update any existing error handling that is tagged with Total Visual CodeTools comments (or specify your own tags):

Error Handling Standards in Total Visual CodeTools for VB6 and VBA/Office

You can specify unique error handling structures for classes, regular modules, and forms/reports. Here's an example of the Modules tab showing the error handling text that goes at the top of the procedure (after comments) and the code at the end of the procedure:

Error Handling Standards for Procedures in New Modules in Total Visual CodeTools for VB6 and VBA/Office

The error handling text can be customized to be much more sophisticated to let you pass information such as the module name #M# and procedure name #P#. The #X# passes Sub or Function depending on the procedure being updated.

Total Visual CodeTools lets you specify naming conventions for variables based on their data type and scope. A powerful option during Code Cleanup is the ability to rename all the variables in your project to your naming convention.

For instance, you may want all your integers to start with "int", strings with "str", etc. The use of a variable naming convention is considered a Best Practice within the VB6/VBA developer community and helps to quickly read a variable name and have an idea of what data it contains. Three tabs are available.

Cleanup Options Tab

The first tab is for general cleanup settings to determine what variables are updated with your naming convention. You can include or exclude the members of user defined types, variables/constants in ALL CAPS, Types and Enums, and variables shorter than a certain length (for instance one character variables such as X which are commonly used as counters).

Naming Convention Standards in Total Visual CodeTools for VB6 and VBA/Office

Data Types

You can specify the variable naming convention tag you'd like to use for every data type. We've included a default set of data types and you can add your own:

Naming Convention for Data Types in Total Visual CodeTools for VB6 and VBA/Office

Variable Scope

In addition to data type, you can also rename variables to reflect their scope. For instance, global variables can start with a "g", module level with a "m", procedure parameters with a "p", etc.

Naming Convention for Variable Scope in Total Visual CodeTools for VB6 and VBA/Office

Code Delivery just has a few options:

Code Delivery Standards in Total Visual CodeTools for VB6 and VBA/Office

  • How to start and increment line numbering
  • The root letter to use if you're obfuscating variable names (all the variables get renamed to this plus a number)
  • Special commenting tags to avoid comment removal (comments that start with this don't get removed when you select comment removal)

The final section is for managing the settings file. By default, the file is stored in your Application Data folder. This can be moved to a network folder so your whole team can share the same settings. You can also add a password to the file to minimize the ability of others to modify it.

Manage Standards in Total Visual CodeTools for VB6 and VBA/Office

Total Visual CodeTools 2010 stores the settings in a Microsoft Access database file. Older versions use a CTS text file. You can import the settings from a legacy CTS file from here. It will overwrite your current settings.

Total Visual CodeTools User manual

Microsoft Office Access 2016, 2013, 2010 Version
is Shipping

New Features

Supports Office/Access 2016, 2013, 2010, 2007, 2003, 2002, 2000, and Visual Basic 6.0!

Also available for
Access 97


View all FMS products for Microsoft Access All Our Microsoft Access Products

Rave Reviews

"Total Visual CodeTools is by far my favorite third-party product."

Alison Balter, Author, Conference Speaker, Instructor


Best Visual Basic Add-In
Rave Reviews

CodeTools Info

Why CodeTools?

Additional Info

 

 

Free Product Catalog from FMS