Understanding Macros


Washing the dishes ”what a chore. Pick up a dirty plate, wash it with soapy water, rinse it off, and then dry it. It's the same every time. But with a dishwasher, all the tedium of washing, rinsing, and drying is automatically handled by the machine, leaving you free to do better things with your time. (Now if you could only get the kids to empty it without being told ) Similarly, you don't want to perform the same tedious series of commands week after week; you just want a specially formatted report to print every Friday. What you need is a macro.

What Is a Macro?

Basically, a macro is a shortcut that performs a series of commands. Rather than manually performing each step necessary to complete a task, you simply tell the software what each step is, what needs to be accomplished in each step, and in what order the steps must occur. Then you designate some way to set this series of commands in motion.

In the past, creating a macro usually involved one of the following two problems:

  • The macro language was powerful but arcane, which resulted in a complicated process that took a lot of time to learn.

  • The macro language was easier to understand but limited in the range of tasks it could perform, making for a very frustrating experience.

In Microsoft Project, however, you have the best of both worlds with Visual Basic for Applications (VBA). A subset of the highly popular Visual Basic programming language, VBA is both powerful and easy to understand. What's more, the tools available in Microsoft Project make creating macros about as easy as can be. Most macros can be created without ever seeing, much less writing, VBA code.

Why Use Macros?

When you use Microsoft Project (or any other business productivity software) you use it because it makes doing your job easier and more efficient. One of the reasons that software can make you more productive is that the features it has are, in a sense, a collection of macros that accomplish tasks that the software designers feel can be accomplished more effectively by using a computer. More importantly for this discussion, these "macros" perform tasks that the designers learned their customers want. But what the designers can't do is create all the features that every customer wants. This is where macros can prove so useful.

Because individual users can create a macro to accomplish some particular task, you can essentially customize the software by adding "features" that support the particular way you do your job.

For example, let's say that you do have to print a certain report every Friday. Before you can print anything, you have to do the following:

  • Choose the right view of your project data.

  • Choose among several filters to exclude unwanted tasks.

  • Choose how and in what way you will sort the data.

  • Choose the report format you need.

After you open the right project, you might have to click your mouse well over a dozen times before you can print the report. With a macro to perform all those steps for you, printing the report would be reduced to only a few mouse clicks.

Just because macros can be used to perform a complex series of steps doesn't mean that every macro has to be elaborate. Maybe you have certain simple things you do in Microsoft Project all the time, such as creating WBS code masks. By recording a macro and creating a new toolbar button for it, you have a convenient one-click method of opening the WBS Code Definition dialog box.

Cross-References  

For more information about creating new toolbar buttons to run macros, see "Creating Toolbar Buttons " later in this chapter.




Microsoft Office Project 2003 Inside Out
Microsoft Office Project 2003 Inside Out
ISBN: 0735619581
EAN: 2147483647
Year: 2003
Pages: 268

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