CitectVBA Programming Reference > CitectVBA Function Reference > Declarations > CreateObject


Creates a new OLE Automation object and assigns a reference to the object.


Set objVarName = CreateObject(objClassName)


The required name of the variable receiving the reference.


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

Dim | Set


' 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.