一段有用的宏

Imports EnvDTE

Imports System.Diagnostics

 

Public Module MaintenanceComment

 

#Region "Field"

 

    Public strDate As String = Format(Date.Now, " yyyy/MM/dd HH:MM:ss")

 

    Public strName As String = DTE.ActiveDocument.Name

 

    Public strLang As String = strName.Split(".")(strName.Split(".").Length - 1)

 

    Public strSep As String = IIf(strLang.ToUpper = "VB", "'", "//")

 

    Public strModifier As String = "Benny.S.Xu"

 

#End Region

 

 

#Region "Add code file header"

    Sub FileHeader()

        DTE.ActiveDocument.Selection.Text = " /*"

        DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = "Copyrigth 2008 Company All rigths reserved"

        DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = "File Name: " & strName

        DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = "Created By:    " & strModifier

        DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = "Created Date:  " & strDate

        DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = "Description:   " & strDate

        DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = "Change History: ID  ModifiedBy ModifiedDate  Desciption"

        DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = "*/"

 

    End Sub

 

#End Region

 

 

#Region "Add Macro"

    Sub Add()

        'DTE.ActiveDocument.Selection.Text = strSep & "------------------------------------------------------------"

        'DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = strSep & "Modified By:" & strModifier

        DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = strSep & "Modified Date:" & strDate

        DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = strSep & "Descriptions:"

        DTE.ActiveDocument.Selection.NewLine(1)

        'DTE.ActiveDocument.Selection.Text = strSep & "------------------------------------------------------------"

        'DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = strSep & "##Add "

        DTE.ActiveDocument.Selection.NewLine(2)

        DTE.ActiveDocument.Selection.Text = strSep & "##End Add"

        DTE.ActiveDocument.Selection.NewLine(1)

        'DTE.ActiveDocument.Selection.Text = strSep & "------------------------------------------------------------"

    End Sub

#End Region

 

#Region "Change Macro"

 

    Sub Change()

        'DTE.ActiveDocument.Selection.Text = strSep & "------------------------------------------------------------"

        'DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = strSep & "Modified By:" & strModifier

        DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = strSep & "Modified Date:" & strDate

        DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = strSep & "Descriptions:"

        'DTE.ActiveDocument.Selection.NewLine(1)

        'DTE.ActiveDocument.Selection.Text = strSep & "------------------------------------------------------------"

        DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = strSep & "##Change "

        DTE.ActiveDocument.Selection.NewLine(2)

        DTE.ActiveDocument.Selection.Text = strSep & "##To"

        DTE.ActiveDocument.Selection.NewLine(2)

        DTE.ActiveDocument.Selection.Text = strSep & "##End Change"

        DTE.ActiveDocument.Selection.NewLine(1)

        'DTE.ActiveDocument.Selection.Text = strSep & "------------------------------------------------------------"

    End Sub

 

#End Region

 

#Region "Delete Macro"

 

    Sub Delete()

        'DTE.ActiveDocument.Selection.Text = strSep & "------------------------------------------------------------"

        'DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = strSep & "Modified By:" & strModifier

        DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = strSep & "Modified Date:" & strDate

        DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = strSep & "Descriptions:"

        DTE.ActiveDocument.Selection.NewLine(1)

        'DTE.ActiveDocument.Selection.Text = strSep & "------------------------------------------------------------"

        'DTE.ActiveDocument.Selection.NewLine(1)

        DTE.ActiveDocument.Selection.Text = strSep & "##Delete "

        DTE.ActiveDocument.Selection.NewLine(2)

        DTE.ActiveDocument.Selection.Text = strSep & "##End Delete"

        DTE.ActiveDocument.Selection.NewLine(1)

        'DTE.ActiveDocument.Selection.Text = strSep & "------------------------------------------------------------"

    End Sub

 

#End Region

 

 

End Module

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值