S
Steve Drenker
I'm using Excel 2004 on a Mac. I understand that VBA in this environment is
equivalent to VB5.5 and the Enum keyword does not exist. Further, enumerated
values are Longs and I can use a User Defined Type in place of the Enum.
Dumb Question: How do substitute a UDT approach for an Enum? I know I have
to define the UDT, declare a variable of that type and then initialize the
items in the type. In the example below, where would I do the initialization
of the elements in the new variable?
TIA,
Steve
Public Enum bdTextCase
bdCaseLower = 0
bdCaseUpper = 1
bdCaseNormal = 2
End Enum
Public Function RandomTextString(ByVal vintLen As Integer, _
Optional vCase As bdTextCase = bdCaseLower) As String
If vCase = bdCaseUpper Then
doThis
ElseIf vCase = bdCaseNormal Then
doThat
Else
doWhat
End If
End If
RandomTextString = [some logic here]
End Function
Sub Test
Application.StatusBar = RandomTextString(5, bdCaseUpper)
End Test
equivalent to VB5.5 and the Enum keyword does not exist. Further, enumerated
values are Longs and I can use a User Defined Type in place of the Enum.
Dumb Question: How do substitute a UDT approach for an Enum? I know I have
to define the UDT, declare a variable of that type and then initialize the
items in the type. In the example below, where would I do the initialization
of the elements in the new variable?
TIA,
Steve
Public Enum bdTextCase
bdCaseLower = 0
bdCaseUpper = 1
bdCaseNormal = 2
End Enum
Public Function RandomTextString(ByVal vintLen As Integer, _
Optional vCase As bdTextCase = bdCaseLower) As String
If vCase = bdCaseUpper Then
doThis
ElseIf vCase = bdCaseNormal Then
doThat
Else
doWhat
End If
End If
RandomTextString = [some logic here]
End Function
Sub Test
Application.StatusBar = RandomTextString(5, bdCaseUpper)
End Test