Chapter 40 -- Creating and Working with VBA Macros

3 4

Chapter 40

If you find that you perform certain tasks repeatedly, you might be able to simplify your life by creating 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 tasks:

  • Automate a complex series of steps
  • Combine multiple commands (such as formatting and inserting tables with a single command)
  • Make menu commands and submenu commands more quickly accessible
  • Speed up editing and formatting procedures

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

In Microsoft 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 also 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.



Microsoft Word Version 2002 Inside Out
Microsoft Word Version 2002 Inside Out (Inside Out (Microsoft))
ISBN: 0735612781
EAN: 2147483647
Year: 2005
Pages: 337

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