Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Terminate Event

Occurs when an instance of the associated class is terminated.

Private Sub Class_Terminate()
End Sub

The statements part consists of zero or more code statements to be run when the class is initialized.

The following example illustrates the use of the Terminate event.

Class TestClass
   Private Sub Class_Initialize   ' Setup Initialize event.
      MsgBox("TestClass started")
   End Sub
    Private Sub Class_Terminate   ' Setup Terminate event.
      MsgBox("TestClass terminated")
   End Sub
End Class
Set X = New TestClass   ' Create an instance of TestClass.
Set X = Nothing   ' Destroy the instance.

Community Additions

© 2015 Microsoft