Special Value of 'Nothing'

Nothing is a special value that applies only to variables with the Object subtype. An object variable is equal to the value Nothing when the subtype is Object, but the object in the variable has either been destroyed or has not yet been instantiated. When testing for whether an object variable is equal to the value Nothing, you do not use the = operator, as you normally would to test for a specific value. Instead, you have to use the special operator Is. However, when you wan to destroy an object, you have to use the Set Keyword in combination with the = operator. Let's look at an example:

Dim objFSO
Dim boolExists
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
If IsObject(objFSO) Then
boolExists = objFSO.FileExists("C:/autoexec.bat")
MsgBox boolExists
Set objFSO = Nothing
If objFSO Is Nothing Then
MsgBox "The object has been destroyed"
End If
End If