If you like the code documenter, please donate so I can keep on developing.
thank you

Document VBA
Modules ... Procedures ... Lines of Code ... References ...
in your Access Databases, Excel Workbooks, Word Documents, and PowerPoint presentations!

Access MVP Home

Access Basics Video Tutorials Learn VBA ListFiles Database Random Picker Error Handling Reference Database Whistles & Bells Help Examples Analyzer for Access Code Documenter

Code Documenter

Quick Jump To Sections


Download, FAQs, and Comments

One of the Code Documenter reports is a web page (and accompanying css file) with all code from your project to easily share with others. If you are a teacher and have developed helpful databases, spreadsheets, documents, or presentations, you can use this tool to post code on your website so others can look up VBA examples when they do a web search. Let's get more VBA posted out there!!!

If you are a developer, you can use this tool to document what you and others have done. The web page has indexes and lots of links to jump around.

If you are learning, you can run the Code Documenter on a database you want to study. You have an option of printing the code with or without the keywords linked to Microsoft's help pages in the actual code listing itself. You also have an option of printing a list of help topics for keywords at the end, which enables you to methodically jump to help for keywords that were used.

Code from all modules can also be automatically written to BAS and CLS files -- this makes them easy to find when you want to put them into another project. Additionally, you can choose to create a TXT file for every procedure. Use search tools like Everything* and BareGrep** to search.

* Everything, free search tool for file names -- separate each word with a space ... ie: search for --> code doc accdb
** BareGrep, free tool to search inside files

Download Code Documenter

The Code Documenter analyzes Access, Excel, Word, and PowerPoint files

Download Access ACCDB
alternate version, not compiled (try this one if the one above is not recognized):

this documents VBA in Access databases, Excel workbooks, Word documents, and PowerPoint presentations

You may not use the ideas in the Code Documenter for any commercial product. License agreement is in the code.

The Code Documenter is being distributed as an accdb. Ideally, the Code Documenter would be part of the Analyzer for Microsoft Access on CodePlex

To run, you must allow access to the VBA project for each application you run the documenter for. In Access, this is:

  • File
  • Options
  • Trust Center
  • Trust Center Settings
  • ActiveX Settings
  • uncheck: Safe Mode

If you make modifications to the code, please share your changes for everyone to benefit. Email strive4peace2010 at -- thanks!

Special thanks to Adrian Bell for connecting with me and putting in code to bypass startup stuff and open the database to analyze as read-only. Adrian's code is in the download for this article (which is another good tool for documenting and finding stuff in Access):
Log Code and Property References by Adrian Bell aka NeoPa on , a free forum for help

Code Documenter Errors

If you have problems compiling the code due to a missing reference. Perhaps the VBA Extensibility Library is not getting pulled in ... I used version 5.3 You can browse for it. Try:

C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\Vbe6ext.olb

... and then compile and save of course.

IMPORTANT: For the Code Documenter to work for Excel, Word, and PowerPoint :
you must enable programmatic access to the VBA Project for each.
In the defaults (File, Options): check 'Trust access to the Visual Basic Project'

Because the Code Documenter is being prepared to go into the Analyzer for Microsoft Access, many of the error handlers have been removed since the Analyzer uses vbWatchdog .

Problems reported with Windows 8.1 ~~ Developers, if you have issues, get the modified OpenBypass function out of the Analyzer for Microsoft Access , which is conditionally compiled for 64-bit.

64-but users: if you make adjustments for this code to run, please share, thanks!

Document VBA in Access, Excel, Word, and PowerPoint

Report buttons

Web Page report for Code and Objects

The biggest enhancement is the ability to write ALL the code for a project to a web page, create BAS and CLS files for each module, and/or output every procedure to its own TXT (text) file. There are also 4 new Access reports (Files, Objects, Modules, and Procedures). The long reports are written to HTML, which is the markup language for web pages.

For the web page reports:

  • Keywords are colored blue and comments are green . Line numbers are printed in a small brown font.
  • User can choose to include links to help pages. Thanks to Tom van Stiphout for this idea. Currently, the links are to pages on Microsoft's Visual Basic for Applications language reference for Office 2013 .

    There are 2 ways to do embed help links:

    1. jumps in the code printouts on each blue keyword with a link
    2. alphabetical list of keywords with links at the end.

    Not all links are in there -- and not all words that have links are checked ... more stuff for the future. If you want to change links, go to the a_KeyWords table, Modify HelpLink and HelpLink2. In the index at the end, HelpLink and HelpLink2 are both referenced. The ending index also breaks key phrases down and references related Help too. For instance, if "On Error Goto" is used in the code, links will also be shown for "On Error", "On", and "Goto".

    If you take the time to edit links, please share your changed a_KeyWords table so the Code Documenter can be updated for all, thank you.

Each report that is written to a file (HTM, BAS, CLS, TXT) is placed in a directory below the Code Documenter with a folder name starting with \CodeDoc_ . The rest of the folder name will come from your report title. The Code Documenter creates the CSS (Cascading Style Sheet) file that is needed for HTM files. The CSS file be in the same directory as the Code Documenter web page files for the special formatting to show.

To open a web page with Word, right click on the HTM document and choose Open With ... Word. This gives you Word's great Document Pane for jumping around using the heading tags, and the ability to edit.

To change HTML files with a text editor, you can Download Notepad++ , which is a free and good. In NotePad++,

  • to color key words: from the menu bar, choose Language, HTML for web pages. (HTM instead of HTML is used by the Code Documenter for file extension -- both are the same.)
  • to change all indents in an area (just like VBA), select multiple lines and press TAB or SHIFT tab.
  • you can also search/replace on regular expressions and extended mode (which lets you replace new lines -- I use \n a lot).

.BAS and .CLS and .TXT Files with code

The Code Documenter can also put all your modules in BAS and CLS files ... and create a TXT file for every procedure in your database.

Download Everything , which is a search tool to find your code snippet files by specifying parts of the filename (separate each part with a space).

If you want to search for words or phrases IN files, Download BareGrep .

Web Page Examples

Click HERE to see sample output of the Code Report created by the the Code Documenter

Index of Code by Module and then Procedure

Index of Code by Procedure and then Module

Help Links at end for Keywords used in code

Code Example

Future: Another report showing lines of code containing words to watch ~

Goto Quick Jump

CLICK the ARROW in the middle of the image to watch the video

Goto Quick Jump

Screen Shots for Code Documenter

STEP 1: Open Code Documenter and click Browse...

<STEP 1: Open Code Documenter and click Browse...>

STEP 2: Choose Application and Browse for File

<STEP 2: Choose File>

STEP 3: Watch it run, Look at results!

<STEP 3: Watch it run, Look at results>

Goto Quick Jump

Works on MDB and ACCDB files

<Code Documenter also works on MDB files>

Goto Quick Jump

Sort Tables, Queries, Forms, Reports, Macros, and Modules

<Sort Tables, Queries, Forms, Reports, Macros, and Modules>

Goto Quick Jump

How much code do you have? How many comments are there?

<How much code do you have? How many comments are there?>

Goto Quick Jump

List all procedures in the database

<List all procedures in the database>

Goto Quick Jump

Show all code lines in the database

<Show all code lines in the database>

Goto Quick Jump

Filter code lines by any phrase

<Filter code by any phrase>

Goto Quick Jump

Double-click filtered line to show whole procedure

<Double-click filtered line to show whole procedure>

Goto Quick Jump

Filter Code Lines by Module

<Filter Code Lines by Module>

Goto Quick Jump

Filter Code Lines by Procedure

<Filter Code Lines by Procedure>

Goto Quick Jump

Find procedures with the same name

<find procedures with the same name>

Goto Quick Jump

Show all Procedure Declarations

<Show all Procedure Declarations>

Goto Quick Jump

Show all the Comments

<Show all the Comments>

Goto Quick Jump

Show code without Comments or Blank lines

<Show code without Comments or Blank lines >

Goto Quick Jump

Copy Procedure to Clipboard ....then simply Paste where you want! ...

<Copy Procedure to clipboard >

Goto Quick Jump

Show all procedures that contain a reference to a particular control next to each other
.... specify the Filter Phrase and show by Procedure -- pretty cool! ...

<Put all the procedures that contain a reference to a particular control together>

Goto Quick Jump

Run the Code Documenter on several databases. Find your latest and greatest stuff. Copy to clipboard and then paste into your current database or find code in files created by the Code Documenter.

You must run this on an unsecured database. There is a macro called mcrRESET to turn off the Hourglass in case the code stops before that happens.

The plan is for the Code Documenter to be incorporated into the Analyzer for Microsoft Access , which is a free download on CodePlex.

CodePlex is Microsoft's sharing and collaboration site. The link to create a new CodePlex project is at the bottom of the Analyzer page. CodePlex is geared toward collaboration on Visual Studio projects -- so if you want, send email for . The Analyzer download on CodePlex is an ACCDB.

If you have issues because something in your database snags the code, please send a bug report!

The Code Documenter may be freely distributed. If you are selling an application and wish to incorporate code or ideas from the Code Documenter, you may not do that.


If you have comments or want to tell me how the Code Documenter helped you, thanks! — .

Goto Quick Jump

You might be thinking to yourself, why is this free? Why should I keep it to myself? I run it on my own projects ... sharing it with you means you will build better databases and Access will be more popular.

Thanks for bug reports, comments, and help from Andrew Craven Rohm, Bob Peterson, Arvin Meyer, Glenn Lloyd, Tom van Stiphout, Adrian Bell, ...


If you are excited about what this tool tells you,
you can help by donating.
Your donations are appreciated ~ thanks

Free Public Forums

There is no substitute for interaction with others while you are figuring things out. There are a number of forums and newsgroups you can join for free where experienced folks graciously volunteer their time to answer your questions. You are not alone! Here are links to get you started:



Yahoo! Tech Groups -- MS Access Professionals

Free Book on Access: Access Basics

Free Tutorials: Video Tutorials

for information on training and development services, email me

Goto Quick Jump

Copyright © 2012-2015 Crystal Long. All rights reserved. | Last Updated: June 2015