53.6. Running a Macro
There are some options to run a macro, but before listing them suppose that you have a very simple macro that updates the text-in-progress bar like what you see in the following code:
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Public Module Chapter53
Sub SetStatusText()
DTE.StatusBar.Text = "Wrox Professional Visual Studio 2008"
End Sub
End Module
Here are the options to run a macro:
Double-click the name of the macro in Macro Explorer.
Press F5 or Ctrl+F5 in the Macros IDE when the cursor is inside the macro code.
Associate a command in the IDE with a macro to run it via a comment.
Run the macro via programming code when appropriate.
Usually you work with the first two options in your daily job, but the third and fourth options are also helpful for very common macros.
For example, if you double-click the name of the SetStatusText macro in Macro Explorer to update the status text, you will get an output like that shown in Figure 53-4.
Figure 53.4. Figure 53-4
When you run a macro, a tape icon then appears in the bottom-right corner of the IDE and in the task bar. To examine this icon, which normally hides quickly, you can run a macro like the following code to keep the icon for a few seconds:
Imports System Imports EnvDTE Imports EnvDTE80 Imports EnvDTE90 Imports System.Diagnostics Public Module Chapter53 Sub ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access