Macros Made Easy - Your first macro
No, wait, don't run away! Even though they're based on Visual Basic for Applications (VBA), there's no actual programming required . Macros are easy to create and can save you lots of time. Promise.
Think of macros as shortcuts to doing the things in Microsoft Word and Excel that you already do over and over again. In fact, as you work, think about what kinds of tasks you do more than a few times a day in these types of documents and make a short list. Then go back and record these tasks as macros.
For example, do you frequently reformat section headings in your Word documents? Let's say you always use Heading 1 but then want the text to be red instead of the default blue. Easily done, and you can even assign it a one-touch button or keyboard shortcut!
The first thing you need to do is add the Developer tab to Word. Don't worry, you won't need to know any code. Just go the Microsoft Office Button at the upper left of your open Word document, click Word Options, click Popular, and then under Top options for working with Word, select the Show Developer tab in the Ribbon check box and click OK.
Some mouse functions that cannot be recorded will be absent while recording your macro, though you can still click most buttons since the macro recorder will substitute the command it represents. Be sure you know how to get around; you may even want to do a "dress rehearsal" before you record so you don't add unnecessary steps.
For our example, you don't actually need to select any text to record the macro but it's a good idea to do so before you start just so you can confirm that it's working as you do the steps.
Is your text selected? Good. Now click the Developer tab, followed by the Record Macro button:
Your macro name will need to be 80 characters or less, start with a letter, and have no spaces or special characters. In addition, some reserved words such as "print" and "table" may cause an error (you'll know it's one of these things if you get "Invalid Procedure Name" when you try to start recording).
I named mine "SectionHead1" and entered Control-H as my keyboard shortcut. Keep all of the rest of the defaults and click OK. Go back to the Home tab and click the Heading 1 button. Then click the Font Color button and select red (or whatever color you want for your headings). Now click back to the Developer tab and click Stop Recording. (There's also a Pause button if at any point you want to regain full control of your mouse, set something up that you don't want recorded, and then continue.)
To test your macro, select some text you want formatted to your new heading style and either use your shortcut key combination or click the Macros button, find your macro name and double click it. If your macro doesn't work as planned and you need to quit it before it finishes, simply press ESC.
Now that you've created a macro, I'm sure you'll think of more steps you can automate in Word and Excel. We'll share some of our favorites in future posts.
Suzanne