Microsoft COM (Component Object Model) is a standard for defining API object, that is to say, allowing applications to communicate through objects possessing a certain number of public methods and properties. ActiveX objects are a special type of COM objects.
COM provides mechanisms for links between applications, including:
- dynamic links between applications, called as OLE (Object Link and Embedding).E.g, they allow you to link a spreadsheet file in a document
- automation mechanisms, to take control of a remote application.
- mechanisms for message exchanges between dynamic applications, called DDE (Dynamic Data Exchange).
Many applications have a COM interface to invoke their functionality via a computer program:
- Microsoft Word
- Microsoft Access
- Microsoft Excel
- Microsoft Internet Explorer
- Microsoft Outlook
Access to COM objects
With COM objects, it is possible to extend the VBScript opportunities by creating instances of objects created by third parties and providing a number of services.
VBScript defines two methods to instantiate a COM object:
creates a new instance of a program with a COM interface and run the program if it is not already open. For example, to open the Excel program:
Set spreadsheet = CreateObject("Excel.Application")
can invoke a program which is already opened or from a file created with this application. For example:
Set monDocument = GetObject("c:\report.doc")
Published by jak58
Latest update on March 13, 2013 at 10:04 AM by jak58.