CREATEOBJECT

CREATEOBJECT(class [,servername])

Returns a reference after creating a new ActiveX or OLE object (Variant).


classThe application name and class of the object to create.
servername(Optional) The name of the network server where the object will be created.

REMARKS
* This function can be used to create a new ActiveX object and assign it to an object variable.
* The "class" argument uses the syntax "appname.objecttype", where appname is the application providing the object and objecttype is the type or class of the object to create.
* The "class" can also be the entire class ID.
* If "servername" = "", then the local machine is used.
* If "servername" is left blank, then the local machine is used.
* To create an ActiveX object, assign the returned value to an object variable.
* Creating references through early binding can give better performance.
* This function should be used when there is no current instance of the object.
* Make sure that any objects created are removed afterwards by using Set object = Nothing.
* You can use the GETOBJECT function when there is a current instance and you want to create a reference to it.
* The equivalent .NET function is Microsoft.VisualBasic.Interaction.CreateObject
* For the Microsoft documentation refer to learn.microsoft.com

Dim xlApp As Excel.Application 
Set xlApp = CreateObject("Excel.Application")
Set xlApp = Nothing

Dim obApp As Object
Set obApp = CreateObject("Word.Application")
Set obApp = Nothing

Dim obApp As Object
Set obApp = CreateObject("PowerPoint.Application")
Set obApp = Nothing

Dim oDictionary As Object
Set oDictionary = CreateObject("Scripting.Dictionary")
Set oDictionary = Nothing

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