To facilitate the maintenance personnel to others ,. the file header comment is indispensable for each class library file in. You can use "Ctrl + C" and "Ctrl + V" to achieve your goal, and use shortcuts to achieve your goal.
How to create a file header comment:
1. Open Vs and click "tool"> "macro"> "macro IDE (I)", that is:
2. In the macro editing window, select "samples"> "add"> "Add new project", that is:
Third: if a new item is added, select "module"> "add". You can change the name or not. That is:
Fourth: You can write comments about the file header. The Code is as follows:
Sub DocumentFileHeader()
Dim doc as document dim docname as string dim companyName as string = "upgrade 9" dim authorname as string = "Zhu Dan" dim versionnumber = "1.1" 'get the file name from the program doc = DTE. activedocument 'get the name of the current editing class docname = Doc. name' will add the focus to the DTE in the file header. activedocument. selection. startofdocument () 'Add a copyright notice DTE. activedocument. selection. TEXT = "'************************************ * ***************** "'Add the desired symbols and text DTE in the string type. activedocument. selection. newline () DTE. activedocument. selection. TEXT = "'Author:" + authorname DTE. activedocument. selection. newline () 'adds an empty row DTE. activedocument. selection. TEXT = "'file name:" + docname DTE. activedocument. selection. newline () DTE. activedocument. selection. TEXT = "'Description:" DTE. activedocument. selection. newline () DTE. activedocument. selection. TEXT = "'creation Date:" + String. format ("{0: d}", date. now) DTE. activedocument. selection. newline () DTE. activedocument. selection. TEXT = "'version:" + versionnumber DTE. activedocument. selection. newline () DTE. activedocument. selection. TEXT = "'************************************ * ******************* "DTE. activedocument. selection. newline () end sub
Don't forget to click Save. In this way, you can use the macro to write the file header comment. So how can I use the shortcut key to call the prepared comments?
Assign shortcut key:
1. Go back to Vs and click "Tools"> "options", that is:
Second: In the options window, click "keyboard", find the file header comment file you just compiled in "display command inclusion", and then in "press the shortcut key, press the shortcut key you want to give it (not enter the shortcut key ...), If your shortcut key and existing objects are used at this time, you will be prompted in the "currently used object shortcut key" item. Then, "allocate" and "OK". The operation is completed, namely:
Note:
In this way, you can use a macro to write a file header comment and assign it a shortcut key. In this way, you only need a shortcut key to solve the file header annotation problem. Note:
As long as you carefully read and learn, you can do it!