Getting Started with Visual Basic Macros

 < Day Day Up > 

One of the first things that macros were designed for was recording a sequence of keystrokes so that they can easily and accurately be replayed. One of the most useful display options in Project is the ability to zoom the display of the Gantt chart so that it shows the entire project. The command to do this is fairly well hidden in the View menu, and it takes a few clicks to get there. This section uses that as an example and defines some terms that you will need to understand later in the chapter.

Before you create a macro, you need to walk through the required actions to be recorded so that you can eliminate any false or unnecessary ones. On a simple macro like the one described in this section, this might not be necessary, but for macros that have many steps, it is very important. When recording a macro, you must do things by selecting them. Using shortcuts such as the Control key will not be recorded properly.

Walking through the steps is easy: Select View, Zoom, Entire Project, and then click OK. The Gantt chart timescale will be reset so that the entire project is displayed.

To record a macro that zooms the display of the Gantt chart so it shows the entire project, follow these steps:

  1. Select Tools, Macro, Record New Macro. This brings up a dialog box that gives you the opportunity to name the macro, give it a command key, give a description, and determine where Project should store it. For now, store it in the Global template file because you want it to be available whenever you are working in Project.

  2. Give it the name ZoomAll and add any notes that you want. When that is done, click OK, and the recorder begins recording.

  3. Select View, Zoom, Entire Project, and then click OK. When you are finished, click on the Stop button to stop the recorder.

    NOTE

    While the recorder is recording, a Stop button pops up on the screen. Click it to stop the recording when you are done. If the button is not visible for some reason, select Tools, Macros, Stop Recording.

  4. It is a good idea to test the macro. For a simple macro like this, the easiest way to test it is to run it. To do so, open a different file, set the timescale so that not all of the project is showing, and then run the macro by selecting Tools, Macros, Run Macro and then selecting the macro. If it is working properly, the macro should zoom with no problem. Always save your work before testing. If your file has been saved, you can always go back if your macro does something unexpected or destructive.

  5. If the macro does not pass the test and does not work correctly, you do not have to delete it and start over. The next section covers how to modify a macro.

TIP

When you are satisfied with the macro, you can add a button to the toolbar for the macro so that you can simply click the button to run the macro.


 < Day Day Up > 


Special Edition Using Microsoft Office Project 2003
Special Edition Using Microsoft Office Project 2003
ISBN: 0789730723
EAN: 2147483647
Year: 2004
Pages: 283
Authors: Tim Pyron

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