零贰'Blog

零贰'Blog - 记录日常点点滴滴..........

VC注释宏COMMENTMAC.dsm

VC代码学习编程

VC注释宏COMMENTMAC

Sub LineComment()

lTopLine = ActiveDocument.Selection.TopLine

lBottomLine = ActiveDocument.Selection.BottomLine

For 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)

else

s = “//” + s

end if

ActiveDocument.Selection.Text = s

Next

End Sub