Monday, April 19, 2010

04/19: AddFileCommentMacro In Visual Studio

 

 

Macro Code :

 

Option Strict Off
Option Explicit Off
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics

Public Module RecordingModule

    Sub AddCommentToFile()
        DTE.ActiveDocument.Selection.Text = "/****************************************************************************"
        DTE.ActiveDocument.Selection.NewLine(3)
        DTE.ActiveDocument.Selection.Text = "Name : Dayang Sun"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.LineUp()
        DTE.ActiveDocument.Selection.Delete(4)
        DTE.ActiveDocument.Selection.Text = "Author"
        DTE.ActiveDocument.Selection.LineDown()
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "File   : " + DTE.ActiveDocument.Name
        DTE.ActiveDocument.Selection.NewLine(2)
        DTE.ActiveDocument.Selection.Text = "Date:"
        DTE.ActiveDocument.Selection.CharLeft()
        DTE.ActiveDocument.Selection.Text = "   "
        DTE.ActiveDocument.Selection.CharRight(False, 2)
        DTE.ActiveDocument.Selection.CharLeft()
        DTE.ActiveDocument.Selection.Text = " " + DateTime.Now
        DTE.ActiveDocument.Selection.NewLine(3)
        DTE.ActiveDocument.Selection.Text = "***************************************************************************/"
    End Sub
End Module

0 Comments:

Post a Comment

<< Home