Solved

Multiline comments in VBA?

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

749 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