How to comment and uncomment blocks of code in the Office VBA Editor
在Office的VBA编辑器(ALT + F11)中,您如何评论或取消注释一段代码?
In the VBA editor, go to View
, Toolbars
, Customise...
or right click on the tool bar and select Customise...
Under the Commands
tab, select the Edit
menu on the left.
Then approximately two thirds of the way down there's two icons, Comment Block
and Uncomment Block
.
Drag and drop these onto your toolbar and then you have easy access to highlight a block of code, and comment it out and uncomment with the click of a button!
See GauravSingh's answer if you want to assign keyboard shortcuts.
Note: You should now see a new icon on the menu bar.
click Modify Selection button on the Customize dialog box.
Under name, add an ampersand (
&
) to the beginning of the entry. So now instead of "Comment Block" it should read &Comment Block .
Press Enter to save the change.
any other commands that you find yourself using often.
There is a built-in Edit toolbar in the VBA editor that has the Comment Block and Uncomment Block buttons by default, and other useful tools.
If you right-click any toolbar or menu (or go to the View menu > Toolbars ), you will see a list of available toolbars (above the "Customize..." option). The Standard toolbar is selected by default. Select the Edit toolbar and the new toolbar will appear, with the Comment Block buttons in the middle.
*This is a simpler option to the ones mentioned.
链接地址: http://www.djcxy.com/p/20588.html上一篇: 如何在Ruby中生成一个随机字符串