VBA 是否包含注释块语法?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24001501/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Does VBA contain a comment block syntax?
提问by Tim.DeVries
In VBA is there a short way to comment out a block of code the same way java uses /*...*/
?
在 VBA 中是否有一种简短的方法可以像 java 使用的那样注释掉一段代码/*...*/
?
回答by LimaNightHawk
Although there isn't a syntax, you can still get close by using the built-in block comment buttons:
虽然没有语法,你仍然可以通过使用内置的块注释按钮来接近:
If you're not viewing the Edit toolbar already, right-click on the toolbar and enable the Edit toolbar:
如果您尚未查看“编辑”工具栏,请右键单击工具栏并启用“编辑”工具栏:
Then, select a block of code and hit the "Comment Block" button; or if it's already commented out, use the "Uncomment Block" button:
然后,选择一个代码块并点击“评论块”按钮;或者如果它已经被注释掉,请使用“取消注释块”按钮:
Fast and easy!
快速简便!
回答by David Zemens
prefix the comment with a single-quote. there is no need for an "end" tag.
用单引号作为注释的前缀。不需要“结束”标签。
'this is a comment
Extend to multiple lines using the line-continuation character, _
:
使用换行符扩展到多行_
:
'this is a multi-line _
comment
This is an option in the toolbar to select a line(s) of code and comment/uncomment:
这是工具栏中的一个选项,用于选择一行代码和注释/取消注释:
回答by syanzy
There is no syntax for block quote in VBA. The work around is to use the button to quickly block or unblock multiple lines of code.
VBA 中没有块引用的语法。解决方法是使用按钮快速阻止或取消阻止多行代码。