7oWmd‖Option ClassModule Statement

4MQj9‖Specifies that the module is a class module that contains members, properties, procedures and functions.

warning

DYo4K‖This statement must be added before the executable program code in a module.


WADQ4‖Parameters:

vqr43‖This statement must be used jointly with Option Compatible statement or Option VBASupport 1, the former is enabling VBA compatibility mode, while the latter is enforcing VBA support on top of compatibility.

FVEx2‖Syntax:

Option ClassModule

EFSA4‖Example:


         Option Compatible
         Option ClassModule
             
         UoERn‖' Optional members go here
             
         Private Sub Class_Initialize()
         GPfM8‖    ' Optional construction code goes here
         K5DSq‖End Sub ' Constructor
         Private Sub Class_Terminate()
         KDnnj‖    ' Optional destruction code goes here
         AmeAe‖End Sub ' Destructor
             
         Lsaqg‖' Properties go here.
             
         RFy5k‖' Procedures & functions go here.