Does VBA contain a comment block syntax? [duplicate]

余生长醉 提交于 2019-12-23 06:49:01

问题


In VBA is there a short way to comment out a block of code the same way java uses /*...*/?


回答1:


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!




回答2:


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:




回答3:


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.



来源:https://stackoverflow.com/questions/24001501/does-vba-contain-a-comment-block-syntax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!