- Recommend:
- 0 Comments
Office XP Tips: Macros 101
Take the tedium out of repetitive tasks with Office XP macros.
Ah, the joys of fatherhood. No parent can forget a child's developmental milestones. Those first words, those precious first steps across the carpet, the development of motor skills. Soon after my son learned to walk, he padded all over the house, exploring every nook and cranny. One day, I watched down the hall from my spot on the couch as he wrapped his chubby little fingers around the corner of the refrigerator door and tugged it open. He beamed at me, triumphant. Delighted, I exclaimed what any father would: "Hey, way to go, buddy! Grab me a beer outta there, will ya?" With glee, he pulled a beer off the shelf and brought it to me, practically bursting with pride. OK, maybe you had to be there. But trust me, it was a joyous occasion--one that was repeated many, many times.
I tell you this story today, friends, because that is what a macro is like: A proud, beer-bearing toddler. That might seem like a bit of a stretch, but it's true that macros live to serve. Office XP lets you create macros that perform unpleasant or repetitive tasks, then run them whenever you want by clicking an icon or pressing a key combination. And while Office doesn't currently provide beer-fetching capabilities, there's almost no limit to the kinds of tasks you can automate in Word, Excel, and PowerPoint.
Macro Basics
A macro is a series of commands, keystrokes, and/or mouse clicks that you save and run whenever you want to. If you find yourself repeatedly performing a particular task in Word, Excel, or WordPerfect, you can lighten your workload by combining the steps into a macro that can be run by clicking an icon or pressing a key combination.
There are two ways of creating Office macros: Recording them or writing them from scratch. Writing a macro from scratch requires that you learn a language called Visual Basic for Applications, or VBA. However, most of the time, it's easier and just as effective to record your keystrokes or mouse clicks using the macro recorder in Word, Excel, or PowerPoint. This week I cover the basics of recording macros. VBA is beyond the scope of this newsletter, but I'll cover some basic concepts in future issues, trying my best to steer clear of programming nerd-dom.
Macro Creation
The process for recording a macro is very similar in Word, Excel, and PowerPoint. You open a new document, worksheet, or presentation and choose Tools, Macro, Record New Macro to open the Record Macro dialog box. There, you assign your macro a name, choose a location for it, and give it a description. Word and Excel let you assign a shortcut key you can use to run the macro later. Word also lets you give the macro a toolbar icon.
Once you complete those tasks and click OK to dismiss the Record Macro dialog box, the Macro Recorder records your keystrokes and mouse clicks. Just type and click away, knowing that whatever you do will be recorded in the macro. You'll notice a tiny floating toolbar that has just two options: Stop Recording and Pause Recording. To take a short break, click Pause Recording. Click the same icon when you're ready to resume. When you're finished recording, click Stop Recording. Congratulations: You're the parent of a bouncy baby macro.
A Task Pane Macro
Let's create a very simple macro to get your juices flowing. I'll create this macro in Word, but the process is so similar in the other applications that you can easily create it in Excel or PowerPoint as well.
Curiously, Microsoft didn't assign a key combination to open the Task Pane. You can open it by choosing View, Task Pane or by manually invoking the same menu command with three keystrokes (Alt-V-K), but both methods are a bit clunky. Instead, let's create a simple macro that opens the Task Pane when you press Alt-T.
Open a new Word document, making sure the Task Pane is closed. Choose Tools, Macro, Record New Macro. In the Record Macro dialog box, type TaskPane in the "Macro name" box. Next, leave the "Store macro in" list set to All Documents (Normal.dot) and highlight the text in the Description field. Type Opens the Task Pane. Then, click the Keyboard icon to open the Customize Keyboard dialog box. Move the cursor to the "Press new shortcut key" field and press Alt-T. Leave the "Save changes in" list set to Normal.dot. Finally, click Assign, then click Close. Now you're recording.
At this point, press Alt-V-K, then click the Stop Recording icon (the little square) on the floating Macro toolbar. Word opens the Task Pane and the Macro toolbar disappears. Now, any time you want to open the Task Pane, just press Alt-T. OK, it's not like having your own miniature servant to fetch you a frosty beverage from the fridge, but you get the idea.
A Few Rules
Keep these rules in mind when creating macros:
- Naming the baby: When you assign a name to your macro, you can't use spaces. Also, be sure to give your macro a logical name so you know what it does later.
- Choosing the crib: When you determine a location for your macro, you're saying whether you'll run it in the current document or in all documents. Most of the time, you'll want to make the macro available to all documents. In Word, choose All Documents (Normal.dot). In Excel, choose Personal Macro Workbook. PowerPoint lets you store the macro in the open presentation only.
- Waking the baby: When you assign a key combination you'll later use to run the macro, you must choose one that's not already assigned to something else (like Ctrl-C, which is assigned to the Copy command). The Record Macro dialog box will warn you if you try to take an assigned combination. It's also helpful to choose one that's related to the task at hand, such as Alt-B for "beer."
- Selecting a security blanket: Because some very mean people spread viruses via macros, XP provides a choice of three security levels, High, Medium, and Low. You set the level by opening an office application and choosing Tools, Macro, Security to open the Security dialog box. If your security is set to High, you won't be able to run macros. If you want to run macros, you'll need to choose either Medium or Low. If you don't mind seeing alert boxes when you run macros, Medium is probably best. If you create macros frequently and don't want to see a lot of alert messages, choose Low.
Plain and Simple
Finally, it's best to keep things simple. Complex macros don't always work like you'd expect. Plus, the simplest macros tend to be the most useful.
The Task Pane macro is simply a basic example to show how macros work. I hope I've inspired you to create your own macros that will save you time and effort. In future articles, I'll present some of my favorite macros and cover Office XP's macro capabilities in more detail. And I promise to stay away from puberty jokes.
Would you recommend this story? YES NO
- Recommend:
- 0 Comments
-
Speed Up Everything!
PCWorld shows you the secrets to improve performance on all your hardware.
-
Master Windows 7!
Our expert guide will help you get the most out of Windows 7.
-
ThinkPad Edge E420 Lenovo Style in an Affordable Package
Buy now direct from Lenovo -
ThinkPad X220 Fast and light, with great input ergonomics and battery life, this powerhouse ultraportable is best-of-breed.
Buy now direct from Lenovo -
ThinkPad X120e One of the best netbooks ever, X120e has the best netbook keyboard ever--nothing else comes close
Buy now direct from Lenovo
- 12 Criteria for Selecting the Best ERP System Replacement An ERP system is your information backbone and reaches into all areas of your business and value chain. Replacing it can open unlimited business opportunities. This white paper explains the 12 criteria that allow you to identify and select the solution that will meet these expectations.
- Leveraging Social Computing Technologies for ERP Applications This white paper details how Web 2.0 technologies support business strategies by improving efficiency, productivity, and collaboration.
















