GetObject

<< Click to Display Table of Contents >>

Navigation:  COM functions >

GetObject

Description

Returns a reference to an Automation object from a file.

Syntax

GetObject([pathname] [, class])

Parameters

Part

Type

Description

pathname

String

Optional. Full path and name of the file containing the object to retrieve. If pathname is omitted, class is required.

class

String

Optional. Class of the object.

 

The class argument uses the syntax appname.objectype and has these parts:

 

Part

Type

Description

appname

String

Required. Name of the application providing the object.

objectype

String

Required. Type or class of object to create.

Remarks

Use the GetObject function to access an Automation object from a file and assign the object to an object variable. Use the Set statement to assign the object returned by GetObject to the object variable. For example:

 

Set CADObject = GetObject("C:\CAD\SCHEMA.CAD")

 

When this code is executed, the application associated with the specified pathname is started and the object in the specified file is activated. If pathname is a zero-length string (""), GetObject returns a new object instance of the specified type. If the pathname argument is omitted, GetObject returns a currently active object of the specified type. If no object of the specified type exists, an error occurs.