In the Store Macro In drop-down list, select the document you want the macro stored in. A macro’s storage location determines how you’ll be able to access and.run It later If you select the current project, the macro will be available only in this project. If you want the same macro somewhere else, you have to copy it to the other project (in the Visual Basic editor or the Organizer) or re-create it. Macros that are stored in a project, including a template, are called local macros. Storing a Project macro in the Global file creates a global macro, available to all project files created in Project 2000.
From the description, you might think that you should save every macro as a global macro, but all the global macros load each time you launch Project 2000; they take up space in memory; and any macro names you use globally can’t be reused in individual projects. Unless a macro is going to receive wide usage, it’s best to store it in the current project
Absolute and Relative References
If you select cells while recording your macro, when you run the macro, it selects the same column (field) each time it is run, regardless of which cell is first selected. The Macro Recorder records an absolute reference to the column (“go.to column 4,” as opposed to “move one column to the right”). It would be nice if it worked the same way for rows, but it doesn’t. By default, the Macro Recorder records movement between rows as a relative reference (“move down 2 rows” rather than
If you want a macro to select columns or move to a column relative to the position of the active cell, choose the Relative Column References option. If you want your macro to select the same row, regardless of the position of the cell pointer when you run the macro (for example, row 3), choose the Absolute (ID) option in the Row References options. You don’t have the same relative/absolute flexibility here that you have in Excel; the entire macro is recorded with the settings you choose in the Record Macro dialog box. (You can change the settings for the next macro you record. The default settings are res toted each time you start Project 2000.)
Recording Your Actions
After you set the options in the dialog box, click the OK button to begin macro recording. The message Recording displays at the left end of the status bar to show that you’ are recording a macro. The Stop Recording tool bar also ,ope.ns. The macro recorder lec.old”, the action. you take, but not the delay between actions, so take your time. If you want the macro to enter text, enter the text now. To include menu commands in the macro, just make menu selections as you normally would. To record the mcr Format- Gantt with macro
Running Macros fro’m the Macros Dialog Box
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. To run a macro, choose Tools > Macro > Macros to open the Macros dialog box, shown in Figure 22.2. By default, macros from all open project files, including the global file, are displayed. Change the selection in the Macros In drop-down list to view only the macros in the current file. Select the macro from the scroll list and click the Run button to execute the macro. You can’t enter text or choose menu options while the macro is executing. When the macro is finished running, Project returns control to you.
In-our project file, one resource name didn’t change to initials when we recorded the macro or when we played it back. It would have been easy to blame the macro, but there’s an easier (and more logical) explanation: that task bar had been changed individually earlier in the project, and the local setting takes precedence over the setting for all bars in the Gantt Chart. To We this, we double-clicked on the bar, switched to the Text tab, selected the Right text box, and clicked the Reset button. When we tested the macro again, the text on all task bars, including our “problem” bar, changed to resource initials.
This may seem obvious, but the only way to know whether the macro really works is to reverse the changes you made when recording the macro before playing it back. Change the Bar Style text to Resource Names, and then run the macro to make sure that names are changed to initials.
Until there’s a “Biggest Macro Bloopers” show in prime time on MSNBC, there no need to save macros that include mistakes and their corrections, or that don’t perform as intended. There are two ways to delete a macro. If you need to improve the way a recorded macro executes, you can record the macro again, using the same name. You are asked if you want to overwrite the existing macro with the new one. If you no longer need a macro, choose Tools > Macro > Macros to open the Macros dialog box, select the macro from the macro list, and click the Delete button to delete the macro from the project, template, or global file.