|
|
You can run macros automatically at the click of a button or the selection of a menu item, which we’ll discuss later in this chapter. You can also manually run macros, which is a great way to verify that they work before you foist them upon your defenseless assistants and team members.
To manually run a macro, follow these steps.
Choose Tools Ø Macro Ø Macros to open the Macros dialog box, shown in Figure 24.2. By default, macros from all open project files, including the global file, are displayed.
Pull down the Macros In list and then select where you’ve stored the macro: in All Open Projects, in the Global Template, or in This Project.
Select the macro you want to run from the list.
Click the Run button to execute the macro. When the macro is finished running, Project returns control to you.
Warning | You can’t enter text or choose menu options while the macro is executing. |
Warning | It’s always a good idea to save your project file before you run a new macro. If you’ve made a mistake during recording, the playback results may not be what you expected—and if you’ve saved your file beforehand, you can always revert to the saved version. |
Figure 24.2: Run your macros directly from the Macros dialog box.
If you recorded the macro correctly, your Gantt charts will now be changed to display resource initials to the right of each bar.
If you didn’t get this result, you may have recorded the macro incorrectly. Repeat the above steps—slowly and carefully, this time—to re-record the macro under the same name.
It’s possible to accidentally create a macro that won’t be able to run to completion because it gets caught in a loop. This typically happens when you make a logical or typing error when creating a macro in Visual Basic; it’s less likely to happen if you make a mistake using the Macro Recorder.
When a macro won’t stop on its own, you need to be able to terminate it. If you need to stop a macro during execution, press Ctrl+Break. (On most keyboards the Break key is shared with the Pause key.) A Visual Basic dialog box opens, allowing you to end program execution or debug the macro in the Visual Basic Editor.
If Ctrl+Break doesn’t stop macro execution, press Ctrl+Alt+Del once to open the Windows Task Manager dialog box. Select the application that contains the macro, and click the End Task button. When you reopen the application, you’ll probably need to revert to the copy of the document that you saved before running the macro.
|
|