How do I assign a shortcut key to a Macro in Visual Studio .NET? Once you have developed a macro, for Visual Studio NET, that you plan to use often, you may want to assign a set of shortcut keys to the macro. This is a simple process. First, record the macro. Figure 1 shows a macro that I have written to duplicate a selected number of lines in a code window.
Figure 1 - Duplicate Selected Lines Macro.
| Sub DuplicateSelectedLines() DTE.ActiveDocument.Selection.Copy() DTE.ActiveDocument.Selection.LineDown() DTE.ActiveDocument.Selection.LineUp() DTE.ActiveDocument.Selection.Paste() End Sub |
