Accessing Other Object Models
Although most of the programming done
with Outlook forms is likely to involve the Outlook object model,
there may be times when you want to access data from some other
application or draw on some system service provided by a particular
object model. The VBScript
CreateObject
function is used for this purpose to
access the object model of some other application, while the VBScript
GetObject
function is the only means available
to get a reference to an existing instance of an application (that
is, to a running application). (For the syntax of both functions, see
their entries in Chapter 9
The Language Reference.)
Warning
The Outlook object model’s Application object also has a
CreateObject method. Although you can call this method, its use is
not recommended from within Outlook. The
GetObject
function exists solely within
VBScript, and is not implemented as a method of the Outlook
Application object.
As Table 6.15 shows, you can instantiate objects like the following using these methods:
- ActiveX Data Objects (ADO)
ADO is a data access technology that offers a uniform methodology for accessing data regardless of location or format. ADO has a relatively “flat” object model, and many objects (like the Recordset object, or the Connection object) can be instantiated independently of one another.
- Data Access Objects (DAO)
DAO is a data access technology intended primarily for use with Access databases. Its top-level object is named DBEngine.
- The Dictionary object ...
Get VBScript in a Nutshell 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.