O'Reilly logo

Excel 2003 VBA Programmer's Reference by Robert Rosenberg, Rob Bovey, John Green, Stephen Bullen, Paul T. Kimmel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

15

Interacting with Other Office Applications

The Office application programs: Excel, Word, PowerPoint, Outlook, Access, Publisher, SourceSafe, and FrontPage all use the same VBA language. Once you understand VBA syntax in Excel, you know how to use VBA in all the other applications. Where these applications differ is in their object models.

One of the really nice things about the common VBA language is that all the Office applications are able to expose their objects to each other, and you can program interactions between all of the applications from any one of them. To work with Word objects from Excel, for example, you only need to establish a link to Word and then you have access to its objects as if you were programming with VBA in Word itself.

This chapter explains how to create the link in a number of different ways and presents some simple examples of programming the other Microsoft applications. In all cases, the code is written in Excel VBA, but it could easily be modified for any other Office application. The code is equally applicable to products outside Office that support the VBA language. These include other Microsoft products such as Visual Basic and SQL Server. There is also a growing list of non-Microsoft products that can be programmed in the same way.

We will also have cause to ponder on macro viruses at the end of this chapter.

We will not attempt to give detailed explanations of the objects, methods, and properties of the other Office applications used in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required