User Defined Type in place of Enum

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
 
A

AA2e72E

Don't understand your question!
If all you want to do is convert a string to something else, use the StrConv
function; look it up in the help file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top