VBA enums give occasional “Constant Expression Required” errors
问题 I'm using an enum defined in a class module in Excel VBA. This has been working fine, but I've started getting a compile error on every time I do a comparison on enum variables: In class CExample: Enum MyEnum Foo Bar End Enum Elsewhere: If someValue = myEnum.Foo Then The text .Foo will be highlighted, and a "Compile error: Constant expression required" message pops up. A search on Google suggests that this can randomly happen, and fixes such as restarting the IDE or adding a space after the