OLEObject.Constructor(ProgramID as String, NewInstance as Boolean)

From Xojo Documentation

Constructor


OLEObject.Constructor(ProgramID as String, NewInstance as Boolean)

Creates a new OLEObject using the passed ProgramID is the COM server’s program ID as stored in the registry. The NewInstance parameter specifies whether to create a new instance of the COM server (True) or try to use an existing one if it is running (False).

Example

The following example automates Internet Explorer.

Dim obj As OLEObject
Dim v As Variant
Dim params(1) As Variant

obj = New OLEObject("InternetExplorer.Application", True)
obj.Value("Visible") = True
params(1) = "http://www.realsoftware.com/%22
v = obj.Invoke("Navigate", params)

Exception err As OLEException
MsgBox(err.Message)