Chapter 11. Maximizing Office with VBA Macros


IN THIS CHAPTER

Using a VBA Macro

362

Recording a VBA Macro

364

Working with the Visual Basic Editor

367

Working with Macros

369

VBA Programming Basics

372


Office gurus know a secret that's crucial for mastering any or all of the Office applications: There are things you can make a program do that are not available via the program's interface (that is, its menu commands, toolbar buttons, and shortcut keys). To accomplish these extra tricks and techniques, you have to go under the program's hood and use Visual Basic for Applications (VBA), the programming language that comes with the Office suite. You use VBA to build small sets of instructions called scripts, or, more commonly, macros. With these instructions, you can make the program perform multiple tasks in a single operation or, as I mentioned earlier, perform tasks that aren't part of the interface. For example, in Chapter 1, "Building Dynamic Documents in Word," I showed you a simple macro that updates all the fields in a document (see Listing 1.1), a task that is otherwise cumbersome to accomplish using traditional methods.

This chapter introduces you to VBA programming. You learn how to run existing macros, record program actions as a macro, and the basics of creating your own macros. Chapter 12, "Putting VBA to Good Use: Practical Macros Everyone Can Use," offers a number of macros that you can use "as is" or modify to suit your needs.

Learning VBA

This chapter gives you only a minimal introduction to VBA programming. However, VBA is a relatively easy language to learn and is well worth the effort if you want to create truly custom functions that are designed to suit your needs and solve your worksheet problems. If you want to take the plunge into VBA programming, may I not-so-humbly suggest my book The Absolute Beginner's Guide to VBA (Que Publishing, 2004).




Tricks of the Microsoft Office Gurus
Tricks of the Microsoft Office Gurus
ISBN: 0789733692
EAN: 2147483647
Year: 2003
Pages: 129

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