Appendix B. VBE Object Model

Officially known as "Microsoft Visual Basic for Applications Extensibility 5.3," the VBE object library provides access to the code and forms within an application, and to the various objects that compose the Visual Basic Integrated Development Environment (VBIDE). By default, this object library is not included in the list of referenced libraries for new projects. In order to use the objects referred to in this chapter, a reference to the Microsoft Visual Basic for Applications Extensibility 5.3 library must be created using the Tools

VBE Object Model

Many of the objects in the VBE object model have the same names as objects in the Excel object model. To distinguish the libraries and to ensure that you have the object from the VBE library, you need to include the VBIDE library name in any Dim statements you may use:

Dim oWinVB As VBIDE.Window      'Always gives a VBE Window
Dim oWinXL As Excel.Window      'Always gives an XL Window
Dim oWin As Window              'Gives an XL Window

All of the applications in Office 2007 share the same development environment — the VBE. The code and forms that belong to each Excel workbook, Word document, Access database, or PowerPoint presentation (that is, the "host document") are grouped into Visual Basic projects (the VBProject object). There is one project for each host document. Outlook has a single Project, which "belongs" to the application.

Links between ...

Get Excel® 2007 VBA Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.