Solved

Multiline comments in VBA?

Posted on 2003-11-03
4
8,152 Views
Last Modified: 2010-12-13
I know how to do a single-line comment in VBA:

'This is a comment

Usually when I do multiple lines I just begin each line with a single quote:

'This is comment line 1
'This is comment line 2
'...
'Comment N...


Is there a multiline comment format (as found in other languages)?


As in:

/*Comment line 1
Line 2
Line 3
Line 4
Line 5  */

(Everything between the /* and the */ is marked as a comment.



Just wondering if VBA has the same sort of thing, and I missed it.


Tom
0
Comment
Question by:knowlton
4 Comments
 
LVL 3

Accepted Solution

by:
syntnx earned 125 total points
Comment Utility
Tom,

You didnt miss it, it just doesnt exist. Although this may help. To comment multiple lines. Enable the edit toolbar, hignlight lines to comment, and click the "comment block" icon on the edit toolbar (middle of toolbar). This will add the ' to whatever you highlight.

Thats the best MS has given us

syntnx
0
 
LVL 44

Assisted Solution

by:Arthur_Wood
Arthur_Wood earned 125 total points
Comment Utility
no, VBA does not allow/support that type of comment notation.  All VBA comments must begin with a ' (single quote), or , using a very OLD format, comment lines can begin with REM (short for REMARK).

However, if you are using VBA in Access 2000 or above, there is cool set of tools that can be downloaded for free (check out http://www.mztools.com) and they include a tool on the Tool bar that allows you to Comment or Un-comment a BLOCK of lines, as a unit.


by the way, 250 points a way too much for such a BASIC question


AW
0
 
LVL 5

Author Comment

by:knowlton
Comment Utility
syntx:  I know about the "comment / uncomment" block toolbar button, and yes, it is handy.  :)

Arthur:  Thanks for your 2 cents.  I'll keep my points lower for future "easy" questions.  :)
0
 
LVL 15

Expert Comment

by:ameba
Comment Utility
Maybe you can use this:

#If 0 = 1 Then
      Beep
      Beep
#End If
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now