OFF: How to Add and Use the Comment Block Command

Last reviewed: February 5, 1998
Article ID: Q171388
The information in this article applies to:
  • Microsoft PowerPoint 98 Macintosh Edition
  • Microsoft Word 98 Macintosh Edition
  • Microsoft Excel Macintosh Edition
  • Microsoft PowerPoint 97 for Windows
  • Microsoft Word 97 for Windows
  • Microsoft Excel 97 for Windows

SUMMARY

The Microsoft Visual Basic Editor allows you to comment and uncomment blocks of code at a time. This command is not available by default; to use this feature you must add the Comment Block and Uncomment block commands to a menu. This article describes how to add the two commands to the Visual Basic Editor standard menu and how to comment code.

MORE INFORMATION

Adding the Comment Block and Uncomment Block Commands

To add the commands to the standard menu in the Visual Basic Editor, follow these steps:

  1. On the View menu, point to Toolbars, and then click Customize.

  2. Click the Commands tab in the Customize dialog box.

  3. Under Categories, click Edit.

  4. Find the Comment Block command, click it, and then drag it to the Standard command bar.

  5. 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:

  1. In the Visual Basic Editor, select a section of code that you want to comment.

  2. Click Comment Block.

  3. To remove comments, select the comments and click Uncomment Block.

If a line of code contains more than one comment, the results may be different from the results you expect. For example, in the following comment:

   ' If strName = "MyName" Then ' Check if strName is equal to MyName.

the Uncomment Block command removes the apostrophe (') at the beginning of the line.

In the following comment

   '  ' This is a comment.

the first time you click Uncomment Block, the leftmost apostrophe is removed. The second time you click Uncomment Block for this comment, the remaining apostrophe is removed.


Additional query words: 8.00 ppt8 vba vbe blocks macword macxl macppt
Keywords : kbprg
Version : WINDOWS:97; MACINTOSH:98
Platform : MACINTOSH WINDOWS
Hardware : MAC x86
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 5, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.