project 2000 is more than just the application and templates you install from a CD. In earlier chapters, you saw some of the flexibility built into Project 2000. You can customize reports, views, and the application interface, This chapter . is an introduction to the most powerful Project 2000 custom tool of all-its profitability. As with the Office 2000 applications, with Project 2000, you can create your own software by telling Project exactly how you want it to work. You’ll use Visual Basic for Applications (VBA)to program in Project 2000. There are essentially two ways to create VBAprograms. The Simplest method available in Project (as well as in Office applications such as Word, Excel, and PowerPoint) is to record macros-VB programs that run within a host application-using a Macro Recorder.
Or, if you’re already familiar with Visual Basic, you can create Project macros by opening a programming module and typing line after line of code. You’ll learn about Visual Basic and Visual Basic for Applications in Chapter 24, “Automating Project 2000 with VBA,” and Chapter 25, “Advanced Programming in Project 2000.” But you don’t have to know how to program in Visual Basic (or even desire that knowledge) to be able to create macros in Project 2000. We’ll begin our work with VB Ausing the Macro Recorder and sneak up on the programming stuff in later chapters.
Creating a Macro
There are three reasons why users create macros: to automate infrequent complex tasks, to efficiently complete frequent tasks, and to make applications accessible for less experienced users.
Managing infrequent complex tasks You have to perform a task that you perform infrequently, and it includes a series of steps that aren’t intuitive. If this were a physical task (such as replacing your car’s timing be}t or making tapioca pudding), you’d have a manual or recipe to follow. Some computer users would save the list of steps in a Word document, and then open or print the document each time they need to perform the task. A macro is a superior alternative to the Word doc because the macro stores and executes the instructions.
Efficiently completing frequent tasks As you use Project, you’ll find yourself changing the same settings in each new project file. For example, you always change the text on the Gantt Chart bars to resource initials rather than resource names, so your Gantt Charts have a consistent, easy-to-read layout. It takes very little time to change the in the view, but it takes only a minute longer to record a macro that you can run each time you start a new project file.
Making Project easier to use You learned the steps to print the five project documents that you circulate at the end of each month, but your administrative assistant could easily print and distribute them. You could send him to Project classes or even buy him his own copy of this excellent book, but learning Project isn’t the priority. Printing reports is. Adding a few macros and putting them on a toolbar makes Project 2000 accessible for a user
In Project 2000, you create macros by using the Macro Recorder. The Ma~o Recorder is like a VCR (but easier to use); you record a series of actions, and then play back the recording at some future time. To record a macro, you turn on the Macro Recorder, complete the steps you want to record, and then save the macro. The next time you need to execute the same steps, you run the macro.
Getting Ready to Record a Macro
Before recording a macro, you should practice the steps you want to record because once you begin recording, all your actions are recorded, mistakes included. Take note of the conditions your macro will operate under and set up those conditions. Will you always use the macro in a specific document? If so, open the document. Will the macro be used to change or format selected text or numbers? Then, have the text or numbers selected before you begin recording the macro, just as you will when you run the macro
at a later time.
when you have practiced the steps and set up the same conditions the macro will run under, select tools >Macro > Record New Macro to open the Record New Macro dialog box, shown in Figure 22.1
The suggested name is “Macro1.” (Microsoft didn’t use a lot of imagination ‘here.) Enter a more descriptive name, rather than a functional name, for the macro, as shown in Figure 22.1. For example, “Corporate Header Footer” is better than “Change Header- Footer” because the name provides a clue as to what gets changed in the header and footer. Visu~1 Basic names, including macro names, can be up to 255 characters long.
The names can contain numbers, letters, and underscores, bu not spaces or other punctuation; and they must begin with a letter. You can enter uppercase and lowercase letters in a name; whereas Visual Basic preserves your capitaliza ion s yle, it is not casesensitive (that is, “Format Gantt Chart With lnitials” and “forrnatzan tchartwtthimtials” are the same name, but one is more difficult to read).
Actually, most of the “best” letters are already used, and the Ctrl-Shift combinations invite problems. Users easily forget to hold Shift, so they end up printing the Gantt Chart instead of formatting Gantt Chart bars. Later in this chapter, we’ll show vcu how to attach macros to command bars, which is our preferred method. You can include shortcut keys for menu selections if you or the people you’re creating macros for prefer the keyboard to the mouse.