84.

Divide and Conquer

The secret to creating a macro capable of handling a long, intricate project is to break the project into small pieces, create a macro for each piece, and then glue the pieces together. If you just turn on the recorder, carry out 400 steps, and cross your fingers hoping for the best, you have about a 1-in-400 chance of having your macro work properly. Let's look at a hypothetical example.

As the bookkeeper at The Garden Company, you have an elaborate month-end project you'd like to automate so that you can delegate it to subordinates when you go on vacation. You get a monthly summary report of orders for the previous month from the order- processing system.

click to expand

The report shows sales information for each combination of state, channel, price range, and category. The order-processing system exports the report as a text file. You prepare the file and add the new month's orders to a cumulative order-history database.

This chapter shows you how to record the tasks that make up this large, complex project and then combine these small macros into one comprehensive macro. Along the way, you might learn some useful techniques for completing everyday tasks as well.



Microsoft Excel 2002 Visual Basic for Applications Step by Step
FrameMaker 6: Beyond the Basics
ISBN: 735613591
EAN: 2147483647
Year: 2005
Pages: 122
Authors: Lisa Jahred

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