Enum Statement documentation [1] mentions Option VBASupport 1. This is wrong, since it depends on Option Compatible (that itself is implicitly activated by Option VBASupport 1, but may be used separately). The latter fact is mentioned on Option Compatible help page [2] "Statement Option VBAsupport 1 sets Option Compatible statement automatically", so no need to mention VBASupport here completely. [1] https://help.libreoffice.org/7.2/en-US/text/sbasic/shared/enum.html [2] https://help.libreoffice.org/7.2/en-US/text/sbasic/shared/compatible.html
Moving to NEW
When switching to Option Compatible, the Basic example in help does not function. Please also note that an enumeration is always private, regardless of the Private/Public specifier that preceedes it. The only way to make a Enum.eration public is to create a function that exposes it publicly.
(In reply to Alain Romedenne from comment #2) > When switching to Option Compatible, the Basic example in help does not > function. That would mean a bug. Option Compatible indeed enables enums; e.g., with and without Option Compatible, (without VBASupport) you get different results compiling the module with enums - it would be a syntax error without Option Compatible. VBASupport should only change runtime, so inability to use compile-time structs is a bug.
(In reply to Mike Kaganski from comment #3) > That would mean a bug. Option Compatible indeed enables enums; e.g., with > and without Option Compatible, (without VBASupport) you get different > results compiling the module with enums - it would be a syntax error without > Option Compatible. VBASupport should only change runtime, so inability to > use compile-time structs is a bug. The following code compiles both with "Option Compatible" and "Option VBASupport 1"; however it only runs with "Option VBASupport 1". Enum eWindowManager WINDOWS = 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 Sub EnumTest MsgBox eWindowManager.WINDOWS End Sub @Mike, maybe Enum is supposed to be available only with VBASupport. See the following test, which uses VBASupport (not Option Compatible) https://opengrok.libreoffice.org/xref/core/basic/qa/vba_tests/enum.vb?r=66b135fa
More information regarding Enum statement can be found in "Enum.erations or Constant groups" post at https://forum.openoffice.org/fr/forum/viewtopic.php?f=8&t=58988 See enum_en.odt attached file.