vs2010 仿XCode风格的头注释宏

Sub DocumentFileHeader()

Dim star As String
star = "//******************************************************************************"

' 将添加焦点定位在文件首部
DTE.ActiveDocument.Selection.StartOfDocument()

' 添加一个版权说明
'DTE.ActiveDocument.Selection.Text = star
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "// "
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "// " + DTE.ActiveDocument.Name
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "// "
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "// " + String.Format("Created by {0} on {1:D}.", "***", Date.Now.ToString("yy-MM-dd"))
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "// " + String.Format("Copyright (c) {0}年 {1}. All rights reserved.", Date.Now.Year,"***")
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "// "
DTE.ActiveDocument.Selection.NewLine()
'DTE.ActiveDocument.Selection.Text = star
DTE.ActiveDocument.Selection.NewLine()
End Sub

你可能感兴趣的:(VS2010)