Automating Code Commenting
Collapse the table of content
Expand the table of content
This documentation is archived and is not being maintained.

Automating Code Commenting

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.

It is a good practice to add thorough comments to any code that you write. Although it might be perfectly clear to you how your code works, it might not be clear to someone else (or even to yourself) when that code must be modified at a later time. Clear comments can save you a lot of time and effort in the future.

The VBA Code Commenter and Error Handler add-in helps you to add consistent comments to your code, including author name, date and time of creation, and other pertinent information. It inserts a header template at the beginning of a procedure; you fill in the blanks. You can choose to add comments to a single procedure, to all of the procedures within a module, or to all procedures in your project at once.

To add comments to your code

  1. From the Add-Ins menu, select VBA Code Commenter.
    Note   The VBA Code Commenter menu item is available only when the VBA Code Commenter and Error Handler add-in is loaded.
  2. Make a selection from the Add Comments To group to determine whether comments will be added to the current procedure, all procedures in the current module, or all procedures in the current project.
  3. Verify that the desired template is selected in the Code Header Template box.
  4. Type the name and initials for the Author if desired. With the default template, this information appears as part of the code comments. This information is stored in the registry for future use. If you do not enter information, the name and initials default to the registered user of the product.
  5. Click OK.

The VBA Code Commenter and Error Handler add-in uses template files (.eht) to control the format of comments. You can edit the standard template (CodeCommenter.eht) or create your own templates using Notepad or another text editor.

See Also

Commenting Code | Using Comments Effectively | Code Commenter and Error Handler Add-In

Show:
© 2016 Microsoft