What are the properties/attributes that show a Module is a Class? RRS feed

  • Question

  • ... and how do I access them?

    peter n roth - http://PNR1.com, Maybe some useful stuff

    • Moved by Chenchen Li Tuesday, October 25, 2016 2:04 AM
    • Moved by Chenchen Li Tuesday, October 25, 2016 2:24 AM WRONG MOVING TO VBA
    Monday, October 24, 2016 11:07 PM


  • Hi,

    Do you want to check if there are any properties or attributes to distinguish Standard Modules and Class Modules?

    You could use Module.Type Property (Access) to check the type of module.


    Function CheckModuleType(strModuleName As String) As Integer
     Dim mdl As Module
     ' Open module to include in Modules collection.
     DoCmd.OpenModule strModuleName
     ' Return reference to Module object.
     Set mdl = Modules(strModuleName)
     ' Check Type property.
     If mdl.Type = acClassModule Then
     ' Insert comment.
     mdl.InsertLines 1, "' Class module."
     CheckModuleType = acClassModule
     ' Insert comment.
     mdl.InsertLines 1, "' Standard module."
     CheckModuleType = acStandardModule
     End If
    End Function



    Tuesday, October 25, 2016 2:22 AM