Solved

Multiline comments in VBA?

Posted on 2003-11-03
4
8,202 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
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 125 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: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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

831 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