Chapter 32: Creating and Working with VBA Macros

 < Day Day Up > 



Overview

If you find that you perform certain tasks repeatedly, you might be able to simplify your life by creating Microsoft Visual Basic for Applications (VBA) macros. Properly used, VBA macros can perform some of your work for you. Many people find themselves cringing at the mere mention of the word macros, but there's really no reason to be intimidated. Simply put, a macro is a series of commands and instructions that are grouped together as a single command. For example, you can record a macro that creates a particularly formatted table and assign the macro to a toolbar button. Then, the next time you want to create a table with the same formatting, you simply click the toolbar button-nothing magical about it, but certainly a welcome convenience!

People typically create macros to perform the following kinds of tasks:

  • Automating a complex series of steps or creating custom procedures

  • Combining multiple commands, such as inserting and formatting tables with a single command

  • Making menu commands and dialog boxes more accessible

  • Speeding up editing and formatting procedures, such as applying custom borders, shading, backgrounds, or watermarks

  • Accessing commonly opened documents, such as company procedure and policy manuals, in-house style sheets, or templates

  • Inserting standard text from another document, such as a frequently used legal disclaimer or company slogan

  • Inserting graphics or objects that are used repeatedly, such as an official logo, a "new item" identifier in a Web page or catalog, or other graphic or object

As you start to use macros, you'll find that they come in handy in a number of situations and let you customize your working environment to suit your needs.

In Word, you can create and run macros in a few main ways: you can view and run existing Word commands, record macros using the Macro Recorder, and hand-code macros using the Microsoft Visual Basic Editor (VBE). In this chapter, you'll be introduced to the built-in Word commands and you'll learn how to create a macro using the Macro Recorder. We'll also look briefly at the VBE (see the sidebar "Initiating a Macro in the VBE"), but learning all the ins and outs of using this tool is beyond the scope of this book.



 < Day Day Up > 



Microsoft Office Word 2003 Inside Out
Microsoft Office Word 2003 Inside Out (Bpg-Inside Out)
ISBN: 0735615152
EAN: 2147483647
Year: 2005
Pages: 373

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