The Macro Explorer

 < Free Open Study > 



Overview

"Potential just means you ain't done it yet".

--Darrell Royal, football coach, University of Texas

WHILE DEVELOPING CODE in Visual Studio, you'll often find yourself repeatedly performing a particular process or series of keystrokes. In previous versions of Visual Studio, with the exception of Visual C++, the only way to do this was to perform the tedious actions over and over again. But now in Visual Studio .NET, you can automate the process by using macros. If you've used Microsoft Word or Microsoft Excel, you're probably familiar with macros. A macro is a set of instructions saved in a file (.Vsmacros) that can be executed later. You can either create the macro manually by typing the code in the Macros IDE, or you can have the environment record a macro for you automatically as you type and click.

Tip 

Clicks on menu options are recorded, but clicks in the Text Editor window are not.

After you've created a macro, you can run it from the Macro Explorer, the Find/Command box, or the Macros IDE. You can even use a keyboard shortcut to execute the macro.

In this chapter, I refer to the complex of features surrounding macros as the macro facility. This encompasses the macro recorder, the Macro Explorer, and the Macros IDE. In many ways, this facility will reduce the number of features that you might want to put into an add-in. Certainly, you can develop some things in a macro quicker than you can put them into an add-in. However, as the tasks become more complex, the tendency and requirement to develop an add-in feature becomes greater. In my estimation, once a feature has been placed into an add-in, it will always be easier to execute that functionality from the add-in than from the macro facility. In other words, it will take fewer keystrokes or mouse clicks to get to it. You will also find that much of the extensibility functionality can only be executed in an add-in and will not execute in a macro.

The most powerful thing that the macro facility provides to the add-in developer is the ability to debug add-in functionality in the macro facility without having to compile and debug it in the add-in. Compiling an add-in, running a second instance of Visual Studio, and connecting to the add-in, only to find that your new code does not work, can become tedious after a while. This is especially true if you only need to change one line of code, but you have to start the process all over again for each change. Here is where the macro facility can really help you.



 < Free Open Study > 



Writing Add-Ins for Visual Studio  .NET
Writing Add-Ins for Visual Studio .NET
ISBN: 1590590260
EAN: 2147483647
Year: 2002
Pages: 172
Authors: Les Smith

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net