vs2008 注释宏

来源:互联网 发布:东风suv景逸x5 知乎 编辑:程序博客网 时间:2024/06/06 14:04

    Sub AddHeadDesc()

        'DESCRIPTION: 添加一个标准的头文件说明
        DTE.ActiveDocument.Selection.StartOfDocument()
        DefaultUserName = "XXX"
        Dim FileName
        FileName = DTE.ActiveDocument.Name
        selection = DTE.ActiveDocument.Selection
        selection.Text = "/*************************************************" + CStr(CrLf)
        selection.Text = " Copyright (C), 2012-2022, xxxxxx. Co., Ltd." + CStr(CrLf)
        selection.Text = selection.Text + "File name:   " + FileName + CStr(CrLf)
        selection.Text = selection.Text + "Author:      " + DefaultUserName + CStr(CrLf)
        selection.Text = selection.Text + "Version:     v1.0" + CStr(CrLf)
        selection.Text = selection.Text + "Date:      " + CStr(Date.Today.Year) + "/" + CStr(Date.Today.Month) + "/" + CStr(Date.Today.Day) + CStr(CrLf)
        selection.Text = selection.Text + "Description:" + CStr(CrLf) + CStr(CrLf)
        selection.Text = selection.Text + "Others:     " + CStr(CrLf)
        selection.Text = selection.Text + "History:    " + CStr(CrLf)
        selection.Text = selection.Text + "1. Date:        " + CStr(Lf)
        selection.Text = selection.Text + "   Author:      " + CStr(Lf)
        selection.Text = selection.Text + "Version:     " + CStr(Lf)
        selection.Text = selection.Text + "Modification:" + CStr(Lf)
        selection.Text = selection.Text + "*************************************************/" + CStr(CrLf)
        'DTE.ActiveDocument.Selection.LineUp(flase, 3)
        DTE.ActiveDocument.Selection.EndOfLine()
    End Sub


    Sub AddMethodDesc()

        'DESCRIPTION: 添加函数注释
        Dim MethodName
        MethodName = DTE.ActiveDocument.Selection.Text
        DTE.ActiveDocument.Selection.StartOfLine()
        selection = DTE.ActiveDocument.Selection
        selection.Text = "/*************************************************" + CStr(CrLf)
        selection.Text = selection.Text + "Function:     " + MethodName + CStr(CrLf)
        selection.Text = selection.Text + "Description:  " + DefaultUserName + CStr(CrLf)
        selection.Text = selection.Text + "Input:       " + CStr(CrLf) + CStr(CrLf)
        selection.Text = selection.Text + "Output:      " + CStr(CrLf)
        selection.Text = selection.Text + "Return:      " + CStr(CrLf)
        selection.Text = selection.Text + "Others:      " + CStr(CrLf)
        selection.Text = selection.Text + "History:    " + CStr(CrLf)
        selection.Text = selection.Text + "1. Date:        " + CStr(Lf)
        selection.Text = selection.Text + "   Author:      " + CStr(Lf)
        selection.Text = selection.Text + "Version:     " + CStr(Lf)
        selection.Text = selection.Text + "Modification:" + CStr(Lf)
        selection.Text = selection.Text + "*************************************************/" + CStr(Lf)
        'DTE.ActiveDocument.Selection.LineUp(flase, 5)
        DTE.ActiveDocument.Selection.EndOfLine()

原创粉丝点击