Recording Macros


Many activities you perform in Project can be repetitive. To save time, you can record a macro that captures keystrokes and mouse actions for later playback. The macro is recorded in Microsoft Visual Basic for Applications (VBA), the built-in macro programming language of the Microsoft Office System. You can do sophisticated things with VBA, but you can record and play back simple macros without ever directly seeing or working with VBA code.

The macros you create are stored in the global template by default, so they are available to you whenever Project is running. (In fact, macros, toolbars, and import/export maps are unique in that, when you create or customize them, Project will store them in the global template rather than the active project plan by default.) The project plan for which you originally created the macro need not be open to run the macro in other project plans. If you want, you can use the Organizer to copy the macro from the global template to another project plan to give it to a friend, for example.

Creating a graphic image snapshot of a view is a great way to share project details with others. However, it’s likely the details you initially capture will become obsolete quickly as the project plan is updated. Capturing updated snapshots is a repetitive task that is ideal for automation through a macro. In this exercise, you record and run a macro in the Parnell Aerospace Promo 17 project plan that creates a GIF image snapshot and saves it locally. From there, you could attach the GIF image to an e-mail message, publish it to a Web site, insert it into a document, or share it in other ways.

1. On the Tools menu, point to Macro, and then click Record New Macro.

The Record Macro dialog box appears.

2. In the Macro name box, type Capture_GIF_Image

Tip 

Macro names must begin with a letter and cannot contain spaces. To improve the readability of your macro names, you can use an underscore (_) in place of a space. For example, rather than naming a macro CaptureGIFImage, you can name it Capture_GIF_Image.

For this macro, we will not use a shortcut key. When recording other macros, note that you cannot use a image from book combination already reserved by Project, so combinations like image from book (the keyboard shortcut for Find) and image from book (Go To) are unavailable. When you click OK to close the dialog box, Project alerts you whether you need to choose a different key combination.

3. In the Store macro in box, click This Project to store the macro in the active project plan.

When a macro is stored in a project plan, the macro can be used by any project plan when the project plan that contains the macro is open. The default option, Global File, refers to the global template. When a macro is stored in the global template, the macro can be used by any project at any time because the global template is open whenever Project is running. In this exercise, since we don’t want to customize your global template, you’ll store the macro in the active project plan.

4. In the Description box, select the current text, and replace it by typing Saves a GIF image of the Gantt Chart view.

image from book

The description is useful to help identify the actions the macro will perform.

5. Click OK.

Project begins recording the new macro. Project does not literally record and play back every mouse movement and passing second, but records only the results of the keystrokes and mouse actions you make. Do not feel rushed to complete the recording of the macro.

6. On the View menu, click Gantt Chart.

Even though the project plan is already showing the Gantt Chart view, including this step in the macro thereby records the action so that, if the project plan were initially in a different view, the macro would switch to the Gantt Chart view.

7. On the View menu, click Zoom.

8. In the Zoom dialog box, select Entire Project, and then click OK.

Project adjusts the timescale to display the entire project.

image from book

9. On the Report menu, click Copy Picture.

The Copy Picture dialog box appears.

10. Under Render image, click To GIF image file, and then click Browse.

11. In the Browse dialog box, navigate to the Chapter 17 Customizing folder, and then click OK.

12. Click OK to close the Copy Picture dialog box.

Project saves the GIF image.

13. On the View menu, click Zoom, click Reset, and then click OK.

Now you are ready to stop recording.

14. On the Tools menu, point to Macro, and then click Stop Recorder.

Next, you will run the macro to see it play back.

15. On the Tools menu, point to Macro, and then click Macros.

The Macros dialog box appears.

16. In the Macro name box, click Parnell Aerospace Promo 17.mpp!Capture_GIF_ Image, and then click the Run button.

The macro begins running, but pauses as soon as Project generates a confirmation message to replace the existing GIF image file (the one you just created while recording the macro).

Important 

Your security level setting in Project affects Project’s ability to run macros that you record or receive from others. You may not have set the security level directly, but it may have been set when you installed Project or by a system policy within your organization.

17. Click Overwrite to overwrite the previously created GIF image file.

The macro resaves the GIF image. Next, you’ll see the results of the macro’s actions.

18. In Windows Explorer, navigate to the Chapter 17 Customizing folder, and double-click the Parnell Aerospace Promo 17 GIF image file to open it in your image editor or viewer application.

The GIF image appears in your image application. In the following figure, we are displaying the GIF image in Internet Explorer.

image from book

19. Close your image viewing application, and then switch back to the Parnell Aerospace Promo 17 project plan in Project.

This macro would be very useful if the Parnell project manager needed to recapture the project plan snapshot frequently. For example, the project manager could recapture it at regular intervals during the planning stage-when the details are being developed-and then again during the execution stage-when the effects of actual progress change the remaining scheduled work.




Microsoft Office Project 2007 Step by Step
MicrosoftВ® Office Project 2007 Step by Step (Step By Step (Microsoft))
ISBN: 0735623058
EAN: 2147483647
Year: 2004
Pages: 247

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