Chapter 31: VBA Primer


image from book Download CD Content

Overview

If you have any concerns about venturing into this chapter, take a deep breath and relax. You’ll be perfectly comfortable here. This is the first thorough primer on Microsoft Visual Basic for Applications (VBA) written for advanced Microsoft Office users, and not for programmers.

I’m not a programmer, so I won’t treat you like one. The fact is that you don’t have to be a programmer to make effective use of VBA (or XML, as discussed in the next chapter). Yes, I use VBA and XML to develop solutions for clients, but that just means I’m taking advantage of all the tools that Microsoft Word, Microsoft Excel, and Microsoft PowerPoint have to offer for creating documents. If you can learn to format a table, create styles, or create fields in Word; to write formulas or generate charts in Excel; or to customize masters in PowerPoint, you can learn VBA.

After years of avoiding VBA because it seemed technical and scary, I fell head over heels one day after I had no choice but to venture into the Visual Basic Editor for a client. I discovered both how easy it is and how much you can do with VBA even with just a basic level of knowledge. But, the most important thing I discovered was how much of the VBA language I already knew just from being an advanced Microsoft Office user. Nearly all elements of VBA that are specific to each program are the names of features and tasks you already know from using the program. Keep in mind that VBA is just an additional way to work with, and expand the capabilities of, the programs you already know.

Outside of the program-specific features and task names, most VBA language and structure is virtually identical across Word, Excel, and PowerPoint. So, the majority of what you’ll learn in this primer will apply to macros you may want to write in any of these programs. However, because I assume that this is your first introduction to writing VBA (or writing any programming language, for that matter), I use one program for most examples, to avoid the confusion of trying to cover too much too fast. Because Word is the primary document production program for Microsoft Office, most examples throughout this primer use Word VBA. Just keep in mind that, once you’re comfortable with Word VBA, you can apply all of the basics you learn to VBA tasks in Excel and PowerPoint as well.




2007 Microsoft Office System Inside Out
2007 MicrosoftВ® Office System Inside Out (Bpg-Inside Out)
ISBN: 0735623244
EAN: 2147483647
Year: 2007
Pages: 299

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