Set obj = GetObject(Path[, Class])
|Path||[optional] (String) Full path and file name containing the object to retrieve. If not set, then class is required.|
|Class||[optional] (String) Class of the object. The name of the application providing the object class of object to create.|
Some applications allow you to activate part of a file. Add an exclamation point (!) to the end of the file name and follow it with a string that identifies the part of the file you want to activate. For information on how to create this string, see the documentation for the application that created the object.
For example, in a drawing application you might have multiple layers to a drawing stored in the file. You could use the following script to activate a layer within a drawing named "SCHEMA.CAD":
Set oObject = GetObject("C:\DRAWINGS\SAMPLE.DRW", "FIGMENT.DRAWING")
oObject.Line 9, 90
oObject.InsertText 9, 100, "Hello, world."
If an object has registered itself as a single-instance object, then only one instance of the object is created, no matter how many times CreateObject function is executed. With a single-instance object, GetObject always returns the same instance if called with the empty string ("") syntax, and it causes an error if the pathname argument is omitted.
Dim oProj, oPm, Val
Set oProj = GetObject("C:\proj2\proj2.pra")
If Not oProj Is Nothing Then
Set oPm = oProj.Application.Pm
Val = oPm("/Data").Item("Temperature").Value