Now that you know how to create VBA code to work with Outlook, you're probably wondering whether you have to enter the VBA editor every time you want to run this code. The answer is no. There are two main ways you can run a VBA procedure from Outlook without entering the VBA editor. You can call a macro directly from the Macros menu, or you can create a custom toolbar button to accomplish the same task. NOTE Other Office products, such as Word and Excel, have the capability to record macros. All a user has to do is start recording, and then go through the steps she wants to record and stop recording. When the user is done, she has the macro built, complete with code that can then be modified for further tweaking. Outlook does not have this feature. A macro in Outlook is really just a code procedure you must write yourself. To view a list of all macros in Outlook, select Tools, Macro, Macros to display Figure 33.8. Figure 33.8. Select a macro to run or view the code behind any macro.From this list, you can select any macro and click Run to execute the code in the macro. You can also edit the macro's code and launch the VBA editor by clicking the Edit button. If you want to step through the code to debug a macro, select Step Into. This isn't a very elegant way to run a macro, and if you routinely run the same macro often, consider creating a toolbar button for the macro. To create a toolbar button to run a macro, use the following steps:
You can use these steps to create toolbar buttons for all of your Outlook macros. |