devxlogo

Add Remarks to Your Procedures

Add Remarks to Your Procedures

You can make your code more readable by always adding a remark on top of all your procedures. Create an add-in that makes it fast and easy. First, run New Project under the File menu and select Addin from the project gallery that appears. In the Project Properties dialog, change the project name to RemBuilder. In the AddToIni procedure (contained in the AddIn.bas module), change the MyAddin.Connect string to RemBuilder.Connect.

Press F2 to show the Object Browser, select the RemBuilder project in the upper combo box, then right-click on the Connect class in the left-most pane and select the Properties menu command. In the dialog that appears, change the description into Automatic Remark Builder (or whatever you want).

In the IDTExtensibility_OnConnection procedure (in the Connect.cls module), search for the My Addin string and modify it to &Remark Builder. This is the caption of the menu item that will appear in the Add-Ins menu. In the Immediate window, type AddToIni and press Enter to register the add-in in the VBADDIN.ini file. In the MenuHandler_Click procedure in Connect.cls, delete the only executable line (Me.Show) and insert this code instead:

 SendKeys "'" & String$(60, "-") & vbCrLf _	& "' Name:" & vbCrLf _	& "' Purpose:" & vbCrLf _	& "' Parameters:" & vbCrLf _	& "' Date: " & Format$(Now, "mmmm,dd yy") _	& "' Time: " & Format$(Now, "hh:mm") & vbCrLf _	& "'" & String$(60, "-") & vbCrLf

Compile this program into an EXE or a DLL ActiveX component, then install the add-in as usual from the Add-In Manager. Before you create a procedure, select the Remark Builder menu item from the Add-Ins menu to insert a remark template in your code window, and you’ll never again have to struggle against an under-documented program listing.

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist