Solved

Comment out a larg block of code

Posted on 2001-08-20
12
573 Views
Last Modified: 2012-05-04
How do I comment out a large block of code at once?

In C++ you can do something like:

/*
...
...
Large block of code
...
...
*/

and the whole block will be commented out.  The compiler ignores everything between the /* and the */

How does this work in VBA?
0
Comment
Question by:knowlton
  • 3
  • 3
  • 3
  • +2
12 Comments
 
LVL 54

Expert Comment

by:nico5038
Comment Utility
Only an insert of a single quote per line or just "disabling" a whole SUB by changing the name ;-(
are the ways I know.

Nic;o)
0
 
LVL 6

Expert Comment

by:devtha
Comment Utility
if you want to block from line 3 to 10 then insert a blank line on line 3 and write


line 2
If false then    'now line 3
 line 2  'old line 3
  ..
  ..
  ..
  ..
  line 10
end if
0
 
LVL 6

Expert Comment

by:devtha
Comment Utility
that was an example of how you can achieve it faster without going to each line and commenting or uncommenting them out...
0
 
LVL 5

Author Comment

by:knowlton
Comment Utility
Your suggestions are both good, but they are work-arounds.

The VBA IDE does not have this built-in???
0
 
LVL 2

Expert Comment

by:Gudare
Comment Utility
The VBA IDE doesn't have that built in *for Access* until the XP version.

Fastest way: Cut/paste to Excel VBA IDE. Hit comment selection, cut/paste back.

-Craig
0
 
LVL 4

Expert Comment

by:maatthias
Comment Utility
You can add this feature to a menu.  Check out this article http://support.microsoft.com/support/kb/articles/Q171/3/88.ASP
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 4

Accepted Solution

by:
maatthias earned 16 total points
Comment Utility
In short,
In module or form design window, right-mouse click your toolbar, choose Customize..., under Commands tab, choose "Edit".  Find "Comment Block" and "Uncomment Block".  You can drag these to, for example, your Debug menu.
0
 
LVL 5

Author Comment

by:knowlton
Comment Utility
maatthias:

Bingo!

Thanks!
0
 
LVL 2

Expert Comment

by:Gudare
Comment Utility
DOH... um, thanks maathias. I'm gonna go sit in the corner and bang my head on the wall now...

-Craig
0
 
LVL 6

Expert Comment

by:devtha
Comment Utility
knowlton did it work as this article is not for access.
0
 
LVL 2

Expert Comment

by:Gudare
Comment Utility
Devtha: It works for AC2k, not 97, in case he doesn't come back since he closed it.

-Craig
0
 
LVL 4

Expert Comment

by:maatthias
Comment Utility
Specifically, it will with VBA 5.0 and up.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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 …

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