You have probably heard about all the benefits of commenting your code. If you are really old school, you may have heard about the POYS (the Programmer Over Your Shoulder), that guy that is you from the past telling you what you were thinking when you wrote that nifty (or awful) code snippet.
Of course, most of the time, we do not have the time to bother commenting our code. That is why a couple of shortcuts might help. If you are enforced by someone else to comment your code, this will take some of the burden out of it.
This set of subs create a comment header and insert a 'Modified' date line into an existing comment header, as shown on the code pane on the right:
The subs should work fine across Office 2003-2007/VBA6.5 applications, but it has been tested in Access 2003 and 2007 exclusively. Of course, everything has changed again with Office 2010, but I bet there is a lot of applications out there using true and tried VBA.
Using the Code
To use the code, simply create a reference to the extensibility library (as shown in the next image) and import the codetools.bas file into your project.
To add a comment header to your code, you set the cursor inside a sub or function and type sysaddheader in the debug pane. When you hit Eenter, a comment header is added right above the sub or function (or to the module, if the cursor is not inside a sub or function body).
You can customize the header in any way you want. The default header will include the sub/function (or module) name, the creation date, and the modified date.
Another macro, sysaddmodified, will insert an extra modified date at the bottom of the comment header.
Incidentally, the sys prefix just helps me distinguish code extensibility functions from regular functions.
Points of Interest
Chances are you love reminiscing in your old code or you hate commenting code. Either way, this might save you some of the trouble. For one thing, it is fun to go back to some code pieces that seem to traverse languages and the test of time.
First public release.