Name
GetObject Function
Class
Microsoft. VisualBasic.Interaction
Syntax
GetObject([pathname] [, class])-
pathname Use: Optional
Data Type: String
The full path and name of the file containing the COM (or ActiveX) object.
-
class Use: Optional
Data Type: String
The class of the object. The
classargument has these parts:-
Appname Use: Required
Data Type: String
The name of the application.
-
Objecttype Use: Required
Data Type: String
The class of object to create, delimited from
Appnameby using a point (.). For example,Appname.Objecttype
Return Value
Returns a reference to an ActiveX object
Description
Accesses an ActiveX server held within a specified file
Rules at a Glance
Although both
pathnameandclassare optional, at least one parameter must be supplied.In situations where you cannot create a project-level reference to an ActiveX object, you can use the
GetObjectfunction to assign an object reference from an external ActiveX object to an object variable.GetObjectis used when there is a current instance of the ActiveX object; to create the instance, use theCreateObjectfunction.If you specify
pathnameas a zero-length string,GetObjectwill return a new instance of the object—unless the object is registered as single instance, in which case the current instance will be returned.If you omit the pathname, the current instance of the object will be returned.
An error is generated if
pathnameis not specified and no current instance of the object can be found.The object variable you will ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access