Solved

Comment out a larg block of code

Posted on 2001-08-20
12
592 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: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
  • 3
  • 3
  • 3
  • +2
12 Comments
 
LVL 54

Expert Comment

by:nico5038
ID: 6407332
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
ID: 6407338
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
ID: 6407341
that was an example of how you can achieve it faster without going to each line and commenting or uncommenting them out...
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 5

Author Comment

by:Tom Knowlton
ID: 6407342
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
ID: 6407358
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
ID: 6407374
You can add this feature to a menu.  Check out this article http://support.microsoft.com/support/kb/articles/Q171/3/88.ASP
0
 
LVL 4

Accepted Solution

by:
maatthias earned 16 total points
ID: 6407392
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:Tom Knowlton
ID: 6407428
maatthias:

Bingo!

Thanks!
0
 
LVL 2

Expert Comment

by:Gudare
ID: 6407447
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
ID: 6407568
knowlton did it work as this article is not for access.
0
 
LVL 2

Expert Comment

by:Gudare
ID: 6407582
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
ID: 6407646
Specifically, it will with VBA 5.0 and up.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server views 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 Access…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

687 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