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.

* 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

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

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

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

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

Dim oHttpRequest As Object
Set oHttpRequest = CreateObject("WinHttp.WinHttpRequest.5.1")

Dim oWIA As Object
Set oWIA = CreateObject("WIA.Vector")

Dim oMSXML As Object
Set oMSXML = CreateObject("MSXML2.XMLHTTP")

Dim oShell As Object
Set oShell = CreateObject("WShell.Script")

Dim oRegExp As Object
Set oRegExp = CreateObject("VBScript.RegExp")

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