OLEObject.Constructor(ProgramID as String)

From Xojo Documentation


OLEObject.Constructor(ProgramID as String)

Creates a new OLEObject using the passed ProgramID is the COM server’s program ID as stored in the registry. It can also be the Class ID (in curly braces). This constructor will try to find a previous instance of the COM server if it is running. Otherwise, it will create a new instance.


The OLEObject class supports setting indexed properties. For example the Word.Document.Compatibility property is an indexed property. Here is an example.

Dim word As New OLEObject("Word.Application")
Dim doc As OLEObject

word.Visible = True
doc = word.Documents.Add

Dim params(1) As Variant
params(1) = Office.wdNoTabHangIndent

doc.Value("Compatibility", params) = True
// or