CitectVBA Programming Reference > CitectVBA Function Reference > Declarations > Set


Assigns an OLE Automation object reference to a variable of object type.


Set objVarName = CreateObject(objClassName) | Nothing


The required name of the variable receiving the reference.


The required class name of the object to be created.

Use the Nothing keyword to release the object reference.

The object variable objVarName must be declared before it can be set to reference an OLE Automation object.

Related Functions

CreateObject | Nothing


' 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