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 applicationthat is, to a running application. (For the syntax of both functions, see their entries in Chapter 10.)
|
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
A part of the Scripting Runtime Library, theDictionary object provides high-performance access to data sets that have identifiable keys.
The Excel Application object
The Excel object model is useful for extracting data from spreadsheets or for manipulating charts. Its top-level object is the Application object.
The FileSystemObject object
A part of the Scripting Runtime Library, the FileSystemObject provides access to the local filesystem.
The Word Application object
The Word object model makes it easy to manipulate Word .doc files as well as Rich Text Format (.rtf ) files. Its top-level object is the Application object.
Object |
ProgID |
Description |
---|---|---|
Connection |
ADODB.Connection |
An ADO database connection |
DBEngine |
DAO.DBEngine |
The DAO object model, primarily for Access databases |
Dictionary |
Scripting.Dictionary |
A high-performance alternative to arrays and collections for keyed data |
Excel |
Excel.Application |
The Microsoft Excel application, for manipulating spreadsheets and charts |
FileSystemObject |
Scripting.FileSystemObject |
Represents the local filesystem |
Recordset |
ADODB.Recordset |
An ADO recordset |
Word |
Word.Application |
The Microsoft Word application for manipulating documents |
Part I: The Basics
Introduction
Program Structure
Data Types and Variables
Error Handling and Debugging
VBScript with Active Server Pages
Programming Outlook Forms
Windows Script Host 5.6
VBScript with Internet Explorer
Windows Script Components
Part II: Reference
Part III: Appendixes
Appendix A. Language Elements by Category
Appendix B. VBScript Constants
Appendix C. Operators
Appendix E. The Script Encoder