OLEObject.Constructor(ProgramID as String)

From Xojo Documentation

Constructor


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.

Example

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

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

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

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

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