Thread: Enum bug?
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Martin Brown Martin Brown is offline
external usenet poster
 
Posts: 230
Default Enum bug?

On 13/04/2011 22:34, Dave Unger wrote:
Hi Ron,

Thanks for your reply.

With the ambiguous name issue, you would need to refer to the Enum you want:
debug.print List1.nam1


Yes, I understand that, IF I was referring to an Enum variable.

I don't understand what you mean be a "missed declaration".


I think you mis-understood my point in this post. In the macro below
I have an un-declared variable "nam3". I would expect to get a
compile error , but I don't. It thinks I'm referencing List2.nam3.
On a large application this could be a real nuisance to locate.


The system would fault you for attempting to assign to an Enum.

Public Enum List2
nam1 = 11
nam3 = 33
End Enum

Sub Test()
Debug.Print nam3
End Sub


You *have* defined the unambiguous symbol nam3 as one of your public
enums in List2.

I am slightly surprised that VBA doesn't warn when you have two enums
with the same name in different lists. It would be more interesting in
the Chinese usage if they were defined with different values.

Regards,
Martin Brown