Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop Enumeration Constants
All,
I'm curious to know if there is a way to loop through the constants of an enumeration. (Or, maybe another way to put this is this: Is there a way to get an enumeration as a collection?) I'll illustrate with a simple example below ("TestEnumLoop"), which puts the constants of XlYesNoGuess into an array, loops through the array, and prints the constant values to the Immediate Window. (Continue reading after "TestEnumLoop" for the "hypothetical code"). Sub TestEnumLoop() Dim varArr As Variant Dim varItem As Variant 'Dim xlEnum As XlYesNoGuess varArr = Array(xlGuess, xlNo, xlYes) For Each varItem In varArr Debug.Print varItem Next varItem End Sub So, I'm curious to know if there is some way to loop through the "collection" of constants for a given enumeration. For example, is there something that would exist for the "hypothetical code" below? Sub HypotheticalLoop() Dim xlEnum As XlYesNoGuess For Each xlEnum In XlYesNoGuess Debug.Print xlEnumTest Next xlEnum End Sub Thanks, Matthew Herbert |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
enumeration members | Excel Worksheet Functions | |||
enumeration by vba or by matric or both | Excel Programming | |||
VSTO Cell Alignment Enumeration | Excel Programming | |||
Enumeration | Excel Programming | |||
Using enumeration with controls | Excel Programming |