How can I "comment out" a large portion of VBA code? There's got to be an easier way than putting a single quote in front of each line. Thanks!
If it's a big chunk, I often use conditional compile to comment out a bunch of stuff. That way it doesn't even have to refer to legit variables and objects, or have legit syntax event. Just do like this:
#if 1 = 2 then
look, ma, no comment symbol, and no error on compile
#end if
Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
I always keep the Edit Toolbar visible in the Code Window. It has the Comment and Uncomment block buttons which do the same but in a very handy way
Like Visual Basic :-D
This is not available as Menu in Access 2K. i don't understand Microsoft at all at times
Like Steve Medvid commented, it is available in Xp
------------------------------------------------------------------------------------------------------ We want to help you; help us to do it by reading FAQ222-2244 before you ask a question.
Thanks Jeremy for an excellent answer to what should not even have to be asked. For all the things Access/VBA can do... To not be able to comment out large portions of code in the bat of eye is absurd.
Thanks to alexyo7 for asking a question that I thought was just to simple to ask, thought I would just get blown off the board with a simple duh?
It's great that this has made so many people happy. I remember when I learned this I was in the middle of testing a bunch of code, and it was hugely helpful. I don't seem to use it much lately, but it is nice to know of.
Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
Using a GoTo to skip code does not cause the intervening code to be commented out. It must still be valid code and will still be compiled - it may still get executed if it contains labels or line numbers which other code branches to - something which would be thrown up as a compile error if the code were actually commented out. It can be a useful technique but it doesn't comment out code, which was the original question.
Enjoy,
Tony
-------------------------------------------------------------------------------------------- We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.