?
Solved

Multiline comments in VBA?

Posted on 2003-11-03
4
Medium Priority
?
8,330 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:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 3

Accepted Solution

by:
syntnx earned 500 total points
ID: 9672844
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 500 total points
ID: 9672860
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:Tom Knowlton
ID: 9672886
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
ID: 9679801
Maybe you can use this:

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

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

777 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