Terminate Event (Visual Basic for Applications)

Microsoft Visual Basic Constants

Terminate Event

           

Occurs when all references to an instance of an object are removed from memory by setting all variables that refer to the object to Nothing or when the last reference to the object goes out of scope.

Syntax

Private Sub object_Terminate( )

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

The Terminate event occurs after the object is unloaded. The Terminate event isn't triggered if the instances of the UserForm or class are removed from memory because the application terminated abnormally. For example, if your application invokes the End statement before removing all existing instances of the class or UserForm from memory, the Terminate event isn't triggered for that class or UserForm.