VC注释宏

    其中包括全屏编辑、文件注释、类注释、函数注释四个宏。为了写程序更加方便,可以为这几个常用的宏添加快捷键。

Sub FullScreen()
'DESCRIPTION: 全屏编辑
    ExecuteCommand "ToggleFullScreen"
End Sub

Sub AddHeadDesc()
'DESCRIPTION: 添加一个标准的头文件说明
    ActiveDocument.Selection.StartOfDocument
    DefaultUserName = "mubai"
    Dim FileName
    FileName = ActiveDocument.Name
    ActiveDocument.Selection = "/*******************************************************************" +_
                        vbLF + " 文件名        :" + FileName +_
                        vbLF + " 创建者        :" + DefaultUserName +_
                        vbLF + " 创建时间    :" + CStr(Now) +_
                        vbLF + " 功能描述    :" +_
                        vbLF + "              " +_
                        vbLF + " ******************************************************************/" +_
                        vbLF
    ActiveDocument.Selection.LineUp flase, 3
    ActiveDocument.Selection.EndOfLine
End Sub

Sub AddClassDesc()
'DESCRIPTION: 添加类注释
    Dim ClassName
    ClassName = ActiveDocument.Selection.Text
    ActiveDocument.Selection.StartOfLine
    ActiveDocument.Selection = "/******************************************************************" +_
                        vbLF + " 类名        :" + ClassName +_
                        vbLF + " 创建时间    :" + CStr(Now) +_
                        vbLF + " 功能描述    :" +_
                        vbLF + "              " +_
                        vbLF + " ******************************************************************/" +_
                        vbLF
    ActiveDocument.Selection.LineUp flase, 3
    ActiveDocument.Selection.EndOfLine
End Sub

Sub AddMethodDesc()
'DESCRIPTION: 添加函数注释
    Dim MethodName
    MethodName = ActiveDocument.Selection.Text
    ActiveDocument.Selection.StartOfLine
    ActiveDocument.Selection = "/******************************************************************" +_
                        vbLF + " 函数名        :" + MethodName +_
                        vbLF + " 参数        :" +_
                        vbLF + " 返回值        :" +_
                        vbLF + " 功能描述    :" +_
                        vbLF + "              " +_
                        vbLF + " ******************************************************************/" +_
                        vbLF
    ActiveDocument.Selection.LineUp flase, 5
    ActiveDocument.Selection.EndOfLine
End Sub

作者: wyangwo   发布时间: 2011-01-04