GETOBJECT([pathname] [,class])

Returns the reference to an object provided by an ActiveX component.

pathname(Optional) The full path of a file containing the object (String).
class(Optional) The class name of the object (String).

* This function can be used to access a current ActiveX object from a file and assign it to an object variable.
* When this function is executed the application associated with the "pathname" is started and the object is activated.
* If "pathname" is zero length (""), then a new object instance of the given class is created.
* If "pathname" is left blank, then "class" is required.
* The "class" argument use the syntax "appname.objecttype", where appname is the application providing the object and objecttype is the type or class of the object to retrieve.
* If "class" is left blank, the default class name for that particular object will be activated.
* Some application allow you to activate parts of a file. You can activate a specific part of a file by appending an exclamation mark and the part name to the "pathname".
* You can use the CREATEOBJECT function when there is no current instance and you want to create the object.
* You cannot use GetObject to obtain a reference to a class created with Visual Basic.
* The equivalent .NET function is Microsoft.VisualBasic.Interaction.GetObject
* For the Microsoft documentation refer to

Dim obWord As Object 
Set obWord = GetObject( , "Word.Application")

Dim obPowerPoint As Object
Set obPowerPoint = GetObject( , "PowerPoint.Application")

Dim obOutlook As Object
Set obOutlook = GetObject( , "Outlook.Application")

Dim objCADObject As Object
Set objCADObject = GetObject("C:\CAD\SCHEMA.CAD")

© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited Top