DIAdem Help

Content Type
Programming Language
Current manual
Table of Contents

Method: GetObject for VBS

Method: GetObject for VBS

Refers to an automation object.
DIAdem does not offer CodeCompletion for objects you assigned with the GetObject function.

Set vGetObject = Object.GetObject([pathname], [classValue])
ObjectVBS
Object with this method. You do not need to specify this object.
[pathname]Variant
Specifies the complete name and the path of the automation object. If you do not specify pathname, the GetObject method returns an active object of the specified type. If an object of the specified type does not exist, an error occurs. If you specify an empty string, the GetObject method returns a new object instance of the specified type.
[classValue]Variant
Specifies the name of the automation object. You enter the automation object in the form Servername.Classname. If you do not specify the object class, the GetObject method specifies from the filename the application and the object to be enabled.
vGetObjectVariant
Refers to an automation object.

The following example checks whether Excel is already running. If Excel has not been started, the example starts Excel and loads an Excel file:

Dim MyObj
On Error Resume Next
Set MyObj = GetObject(,"Excel.Application")
If Err.Number = 0 Then
  Call MsgBox("Excel is running")
Else
  Err.Clear()
  Call MsgBox("Excel is not running. Excel will be started.")
  Set MyObj = GetObject("","Excel.Application")
End If
On Error Goto 0
MyObj.Visible = True
Call MyObj.Workbooks.Open(ProgramDrv & "Examples\Data\DIADEM.XLS")
In This Section
Was this information helpful?