VBScript - Component Object Model

Ask a question


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
  • etc..

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:
CreateObject 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")

GetObject can invoke a program which is already opened or from a file created with this application. For example:
Set monDocument = GetObject("c:\report.doc")


Jean-François Pillou

CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Learn more about the CCM team