Releases an OLE Automation object reference from a variable of object type. The Nothing keyword is used in a Set statement.
In the following declaration syntax example, each placeholder shown inside arrow brackets ( <placeholder> ) should be replaced in any actual code with the value of the item that it describes. The arrow brackets and the word they contain should not be included in the statement, and are shown here only for your information.
SetobjVarName = Nothing
The required name of the variable receiving the reference.
The nothing keyword should be used when you are finished with an object, to clear any variables that reference the object, so the object can be released from memory.
CreateObject | Function | 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