Microsoft Office Tutorials and References
In Depth Information
Working with Object Libraries
Automation with other Microsoft Office programs works only when you have
those programs installed on your computer. If you don’t have Word, Excel,
or Outlook installed, you won’t be able to control them from Access.
Working with Object Libraries
To use VBA to control another program, you need to have access to that
program’s object library. Each program has its own properties and methods
that allow VBA to control it. Just as each object (such as a form, text box, or
button) has its own properties and methods, each application — including
Access — has a set of properties and methods, collectively referred to as the
object library.
To access another program’s object library, you first have to tell VBA
where to find it. To add an object library to your VBA project, choose
Tools References in Visual Basic Editor and then add the desired object
libraries, as shown in Figure 1-1.
For more information on using Visual Basic Editor, see Book VIII, Chapter 1.
Figure 1-1:
from the
dialog box.
In Figure 1-1, we chose Microsoft Excel 15.0 Object Library, Microsoft Office
15.0 Object Library, Microsoft Outlook 15.0 Object Library, Microsoft Word 15.0
Object Library, and Microsoft PowerPoint 15.0 Object Library. Selected
items appear at the top of the list when you open the References dialog box,
so they may not always appear in the same order.
If you have multiple versions of a program installed on your computer (Excel
2007 and Excel 2013, for example), you see different versions of the Excel object
library in the References dialog box (refer to Figure 1-1). If you’re sure that
you’ll be working only in the latest version, choose the version with the
highest number. Applications in Office 2013 are version 15.0, whereas
applications in Office 2010 are version 14.0.
Search JabSto ::

Custom Search