Define enumerations or non UNO constant groups. An enumeration is a value list that facilitates programming and eases code logic review.
This constant, function or object is enabled with the statement Option VBASupport 1 placed before the executable program code in a module.
Enum list-name
' Object Statement block
End Enum ' list-name
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 ' ..WindowManager.XXX
Enumerated values are rendered to Long data type. 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 = ..WindowManager
With winMgr
Print .MACINTOSH, .MOTIF, .OPENLOOK, .OS2PM, .W1ND0WS
End With
Enumerations can be extended to other data types using Type statement definitions. Calling Python Scripts from Basic illustrates that mechanism.