After reading Younker's Comment / Uncomment SELECTED CODE IN Visual C , you have a deep harvest.
http://www.9cbs.net/develop/read_article.asp?id=578
I made an Add-IS in the article, but Toolbar always has only one button. Uncomment's Button does not appear, toned for a while, not successful. Later, I want to use the macro's way to pick younker code. The result is actually a successful. Moreover, the code is simple and convenient (there is a simpler, tell me :-)). code show as below:
Sub linecomment () lTopLine = ActiveDocument.Selection.TopLinelBottomLine = ActiveDocument.Selection.BottomLineFor I = lTopLine To lBottomLine ActiveDocument.Selection.MoveTo I, 1 ActiveDocument.Selection.SelectLine s = ActiveDocument.Selection.Text s = "//" s ActiveDocument.seection.text = SNEXTEND SUB
Sub lineuncomment () lTopLine = ActiveDocument.Selection.TopLinelBottomLine = ActiveDocument.Selection.BottomLineFor I = lTopLine To lBottomLine ActiveDocument.Selection.MoveTo I, 1 ActiveDocument.Selection.SelectLine s = ActiveDocument.Selection.Text if left (s, 2) = "//" THEN S = Right (s, len (s) - 2) end if ActiveDocument.selection.text = SNEXTEND SUB
Interested brothers can do this:
1. Click the Tool-> Macros ... menu, click Edit to enter the editing interface, go up on the two VBScript subroutines in the top, close this window.
2. Click the Tool-> Customize menu, select the Command tab, select Macros in the drop-down box, in the top of the Commands list, press and hold the left button to drag the LineComment to the toolbar, select the picture or text annotation, lineUncomment.
3. Come. Try to open a C / C file, is it very cool?