CreateObject
Creates a new OLE Automation object and assigns a reference to the object.
Syntax
Set objVarName = CreateObject(objClassName)
objVarName:
The required name of the variable receiving the reference.
objClassName:
The required class name of the object to be created.
The object variable objVarName must be declared before it can be set to reference an OLE Automation object.
Related Functions
Example
' create variable to store object reference
Dim objWord as Object
' create object and assign reference to variable
Set objWord = CreateObject( "Word.Document" )
' insert appropriate VBA code here to manipulate Word object
' release reference
Set objWord = Nothing.