CreateObject Method

Top  Previous  Next

Creates an ActiveX Object.

[VBScript]

Set obj = Installer.CreateObject(ProgId)

 

[JScript]

obj = Installer.CreateObject(ProgId);

Parameters

obj

The instance of created ActiveX object.

ProgId

The ProgId string value of object to create.

Remarks

This method allows you to create an instance of ActiveX object registered with this ProgId. You may use it as a script-independent way of creating objects.

Installer variables are supported in the ProgId parameter. To emit the value of installer variable MyVar, use the following form: ${MyVar}.

Uninstall support

This action does not require uninstallation.

Example (VBScript)

Set obj = Installer.CreateObject("Word.Application")

' Determine the path to MS Office 'Templates' folder

Installer.Variables("MSTemplatePath") = obj.Options.DefaultFilePath(2)

obj.Quit

Set obj = Nothing

Example (JScript)

var obj = Installer.CreateObject("Word.Application");

// Determine the path to MS Office 'Templates' folder

Installer.Variables("MSTemplatePath") = obj.Options.DefaultFilePath(2);

obj.Quit();

obj = null;