I like having comments in the code that shows who did it and when. You can obviously get more complex, but this is good for me.
To make your own macro to look like “//SBE 06/04/2004: “, do this:
- Open Macro Explorer w/in VS.NET. (Tools –> Macros –> Macro Explorer)
- Create a function like the one below in any module. My example below uses a module called “Module1” (those are my initials BTW).
- Close Macro Explorer and go to Tools –> Options –> Environment –> Keyboard.
- Select your macro, like (Macros.MyMacros.Module1.Comment)
- Select “Global” or whatever you like, in “Use new shortcut in”
- Go To “Press shortcut key(s)” and select on your keyboard a combination. Mine is
-Q. Hit “Assign”. If it is already in use, it will tell you to create your own mapping scheme. Just do it.
- Test it out in your code.
DTE.ActiveDocument.Selection.Text = "//SBE " +
Date.Today.ToString("MM/dd/yyyy") + ": "
Update 5/19/05: For Visual Studio 2005, you will find the dialog at Tools –> Customize –> Keyboard…