Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Get an enum value assigned

Hi everyone,

Put it simply,

Enum SecurityLevel
IllegalEntry = -1
SecurityLevel1 = 0
SecurityLevel2 = 1
End Enum

How can I get -1 of "IllegalEntry " above, provided I know "IllegalEntry"?

I tried Application.Evaluate("IllegalEntry "), but in vain...

Thanks,
Tetsuya
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Get an enum value assigned

The evaluate function uses the worksheet to perform the calcualtion and the
worksheet will not recognize the enum. Simply use the enumeration

a = IllegalEntry

or

msgbox(IllegalEntry)

"Tetsuya Oguma" wrote:

Hi everyone,

Put it simply,

Enum SecurityLevel
IllegalEntry = -1
SecurityLevel1 = 0
SecurityLevel2 = 1
End Enum

How can I get -1 of "IllegalEntry " above, provided I know "IllegalEntry"?

I tried Application.Evaluate("IllegalEntry "), but in vain...

Thanks,
Tetsuya

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,805
Default Get an enum value assigned

Sample code
Public Enum SecurityL
illegalentry = -1
SecurityLevel1 = 0
SecurityLevel2 = 1
End Enum
Sub a()
Dim slevel As SecurityL
slevel = illegalentry
MsgBox slevel
slevel = SecurityLevel1
MsgBox slevel
slevel = SecurityLevel2
MsgBox slevel
End Sub

'enum can be declared as the type
'assigned any value from its members
'used as a constant with the value equal to the member assigned...
--
Always provide your feedback so that others know whether the solution worked
or problem still persists ...


"Tetsuya Oguma" wrote:

Hi everyone,

Put it simply,

Enum SecurityLevel
IllegalEntry = -1
SecurityLevel1 = 0
SecurityLevel2 = 1
End Enum

How can I get -1 of "IllegalEntry " above, provided I know "IllegalEntry"?

I tried Application.Evaluate("IllegalEntry "), but in vain...

Thanks,
Tetsuya

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 97 Enum Larry Dodd[_2_] Excel Programming 5 April 11th 05 11:15 AM
Enum Daniel[_4_] Excel Programming 3 December 22nd 03 12:30 AM
Enum in Excel 97 Rob Bovey Excel Programming 0 September 26th 03 11:02 PM
Enum in Excel 97 Chip Pearson Excel Programming 0 September 26th 03 10:03 PM


All times are GMT +1. The time now is 06:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"