目录
引出
VC++开发报错——LINK : fatal error LNK1168: cannot open Debug/Menu.exe for writing
报错及解决
LINK : fatal error LNK1168: cannot open Debug/Menu.exe for writing
日积月累,开发集锦
多行注释的实现
新建一个宏文件,Macro文件
输入代码
'------------------------------------------------------------------------------
'FILE DESCRIPTION: 批量注释和取消批量注释
'------------------------------------------------------------------------------
Sub SetSelNote()'Sun DESCRIPTION: 过程SetSelNote 用于将选中的文本转换为注释
dim CurWin '当前获得的窗口
set CurWin = ActiveWindow
if CurWin.type<>"Text" Then '判断当前窗口是否是文本窗口
MsgBox "当前窗口不是代码窗口"
else
NoteType = "//"
BeginLine = ActiveDocument.Selection.TopLine
EndLine = ActiveDocument.Selection.BottomLine
if EndLine < BeginLine then
Line = BeginLine
BeginLine = EndLine
EndLine = Line
else
for row = BeginLine To EndLine
ActiveDocument.Selection.GoToLine row
ActiveDocument.Selection.SelectLine '选中当前行
ActiveDocument.Selection = NoteType + ActiveDocument.Selection
Next
End if
End if
End Sub
Sub CancelSelNote()
dim CurWin '当前获得的窗口
set CurWin = ActiveWindow
if CurWin.type<>"Text" Then '判断当前窗口是否是文本窗口
MsgBox "当前窗口不是代码窗口"
else
BeginLine = ActiveDocument.Selection.TopLine
EndLine = ActiveDocument.Selection.BottomLine
if EndLine < BeginLine then
Line = BeginLine
BeginLine = EndLine
EndLine = Line
else
for row = BeginLine To EndLine
ActiveDocument.Selection.GoToLine row
ActiveDocument.Selection.SelectLine'选中当前行
SelBlock = ActiveDocument.Selection
Trim(SelBlock)
pos = instr(SelBlock,"//")
if pos