Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I’m just wondering if anyone else has come across this Enum “quirk”. Tested on XL2003 & 2010. Option Explicit Public Enum List1 nam1 = 11 nam2 = 22 End Enum Public Enum List2 nam1 = 11 nam3 = 33 End Enum Scenario 1: Sub Test () Debug.Print nam1 End Sub Do a compile. I was expecting a “Compile error: Variable not defined” message, but got “Compile error: Ambiguous name detected: nam1” message instead. Scenario 2: Sub Test() Debug.Print nam3 End Sub This did NOT generate a compile error, but printed “33” when executed. Scenario 3: Sub Test() Dim nam3 As Long nam3 = 99 Debug.Print nam3 End Sub Of course, this one compiled without error and printed “99” on execution. In the past I’ve depended on the compiler to pick up missed declarations, but it seems this can’t be relied on when Enums are involved. Any comments appreciated. Regards, Dave U |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Get an enum value assigned | Excel Programming | |||
Enum | Excel Programming | |||
Enum in Excel 97 | Excel Programming | |||
Enum in Excel 97 | Excel Programming |