Πρόταση Enum [VBA]

Καθορισμός απαριθμήσεων ή μη σταθερών ομάδων UNO. Απαρίθμηση είναι κατάλογος τιμών που διευκολύνει τον προγραμματισμό και την λογική επιθεώρηση του κώδικα.

warning

This function or constant is enabled with the statement Option VBASupport 1 placed before the executable program code in a module.


Σύνταξη:

Enum

Object Statement block

End Enum

Παράμετροι:

Within a given enumeration, fit together values that logically relate to one another.

Παράδειγμα:


       Option VBASupport 1
       Private Enum _WindowManager
           W1ND0WS = 1 ' Windows
           OS2PM = 2 ' OS/2 Presentation Manager
           MACINTOSH = 3 ' Macintosh
           MOTIF = 4 ' Motif Window Manager / Unix-like
           OPENLOOK = 5 ' Open Look / Unix-like
       End Enum
       Public Function WindowManager() As Object
           WindowManager = _WindowManager
       End Function ' <library>.<module>.WindowManager.XXX
    
note

Enumerated values are rendered to Long datatype. Basic functions are public accessors to enumerations. Enumeration names and value names must be unique within a library and across modules.


Χρήση:

Display WindowManager grouped constant values:


       Dim winMgr As Object : winMgr = <library>.<module>.WindowManager
       With winMgr
           Print .MACINTOSH, .MOTIF, .OPENLOOK, .OS2PM, .W1ND0WS
       End With
    

Const statement, constants

Option VBASupport statement

With statement