   MSVC Macro Shortcut?
  Hello,Im looking to learn a thing or two about macros for MSVS2003/05 (I have 2003 pro and 2005 standard).  Basicaly I want a macro that lets me use a keystroke say ctrl-shift-d that would enter the current date and time onto the page at the location im at.  My manager has started wanting the code-drops to contain dates/times above all changes to the files, comments, etc, and this would help extreemly.  Usualy I manualy look at the time, due to shoddy memory I oftain have to actualy look up the date aswell, etc.  So I have 3 questions1) Is something like this already availiable, if so where can I get it?2) How do I attach a MSVS Macro to a keystroke?3) Can anyone point me to a good tutorial on those kinds of macros.  Googling returns alot of weird things that are insegnificant compared to what im looking for, even limiting the search to site:msdn.microsoft.com, its almost as if the macro enviornment has little readily availiable information.Thanks!Richard   
  Hey,I've messed a long time ago with macros so my memories are a little fuzzy...1) Most likely, but I don't know where you could find it, if you find the right wording formula, google might be helpful...2) Tools->Options->Environment->Keyboard ... in the list box, starting at Macros... are listed the available macros, you should find yours there, simply use the Press Shortcut Key text box to select your shortcut and apply it3) Sorry I can't, but google for stuff like DTE.ActiveDocument, after that, its some VB script so you can rely on your VB / VB script knowledge to finish the macro :)If this doesn't help you enough, drop me a PM, I'll see if I can find the code to do just thatCheers   ;  Here is a macro i wrote that inserts a file header with the time and date automatically, along with the file name. It also places the cursor at the correct position so you can type your file comment straight away.Here is is:    Sub FileComment()   Dim instance As DateTime   DTE.ActiveDocument.Selection.Text = "/*******************************************************\"   DTE.ActiveDocument.Selection.NewLine()   DTE.ActiveDocument.Selection.Indent()   DTE.ActiveDocument.Selection.Text = "Filename:"   DTE.ActiveDocument.Selection.Indent()   DTE.ActiveDocument.Selection.Text() = DTE.ActiveDocument.Name   DTE.ActiveDocument.Selection.NewLine()   DTE.ActiveDocument.Selection.Text = "Author:"   DTE.ActiveDocument.Selection.Indent()   DTE.ActiveDocument.Selection.Indent()   DTE.ActiveDocument.Selection.Text = "David Lovegrove"   DTE.ActiveDocument.Selection.NewLine()   DTE.ActiveDocument.Selection.Text = "Date:"   DTE.ActiveDocument.Selection.Indent()   DTE.ActiveDocument.Selection.Indent()   DTE.ActiveDocument.Selection.Text = DateTime.Now   DTE.ActiveDocument.Selection.NewLine()   DTE.ActiveDocument.Selection.Text = "Desc:"   DTE.ActiveDocument.Selection.Indent(1)   DTE.ActiveDocument.Selection.Indent()   DTE.ActiveDocument.Selection.NewLine()   DTE.ActiveDocument.Selection.DeleteLeft(1)   DTE.ActiveDocument.Selection.Text = "\*******************************************************/"   DTE.ActiveDocument.Selection.NewLine()   DTE.ActiveDocument.Selection.LineUp(False, 2)   DTE.ActiveDocument.Selection.EndOfLine()    End SubOutput:/*******************************************************   Filename:DXGBaseFrame.cppAuthor:David LovegroveDate:25/04/2006 21:50:14Desc:Implementation for the DXGBaseFrameentity.\*******************************************************/Hope that helps,Dave   ;  An alternative (though not necessarily the best for this situation) is Visual Assist's Autotext - you can set it up so that typing in something like "now" will expand to "// $YEAR$-$MONTH_02$-$DAY_02$ $HOUR_02$:$MINUTE$:$SECOND$" (or whatever format you want).(Another alternative could be to use the revision control system's memory of dates/times of every update (via "cvs annotate" or "svn blame" or something equivalent) instead of duplicating all that in the source code, but presumably that's not an option...)   ;  Thanks, I appreciate the help, that actualy should be enough to go by to create it I believe.Excors: VirtualAssist would not be good in this case, as I dont want to be limited in typing common things, and I dont want to have to type something cryptic.   