This article was previously published under Q171388
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
The Microsoft Visual Basic Editor allows you to comment and uncommentblocks of code at a time. This command is not available by default; to usethis feature you must add the Comment Block and Uncomment block commands toa menu. This article describes how to add the two commands to the VisualBasic Editor standard menu and how to comment code.
Adding the Comment Block and Uncomment Block Commands
To add the commands to the standard menu in the Visual Basic Editor, followthese steps:
On the View menu, point to Toolbars, and then click Customize.
Click the Commands tab in the Customize dialog box.
Under Categories, click Edit.
Find the Comment Block command, click it, and then drag it to the Standard command bar.
Find the Uncomment Block command, click it, and then drag it to the Standard command bar.
Using the Comment Block and Uncomment Block Commands
To comment a block of code, follow these steps:
In the Visual Basic Editor, select a section of code that you want to comment.
Click Comment Block.
To remove comments, select the comments and click Uncomment Block.
If a line of code contains more than one comment, the results may bedifferent from the results you expect. For example, in the followingcomment:
' If strName = "MyName" Then ' Check if strName is equal to MyName.
the Uncomment Block command removes the apostrophe (') at the beginning ofthe line.
In the following comment
' ' This is a comment.
the first time you click Uncomment Block, the leftmost apostrophe isremoved. The second time you click Uncomment Block for this comment, theremaining apostrophe is removed.
Microsoft PowerPoint 98 for Macintosh, Microsoft Word 98 for Macintosh, Microsoft Excel 98 for Macintosh, Microsoft PowerPoint 97 Standard Edition, Microsoft Word 97 Standard Edition, Microsoft Excel 97 Standard Edition