![]() |
Get an enum value assigned with *concatenated* string
Hi everyone,
Thanks for Joel and Sheeloo for my previous post. I want to now concatenate a name of enum item and get its value. So, an example is: Enum Periodicity abcWeekly = 52 abcMonthly = 12 abcYearly = 1 End Enum The reason why I want to do this is 1) get user input of "Monthly" and 2) add a prefix of "abc" to get a value of "12"! How can I do that? I tried Application.Evaluate("abc"&"Monthly"), but in vain... Thanks in advance! |
Get an enum value assigned with *concatenated* string
It has been explained to you already why you cannot use evaluate.
Keep it simple and use say a case statement Enum Periodicity Weekly = 52 Monthly = 12 Yearly = 1 End Enum Select Case UserInput Case "Weekly": Res = Weekly Case "Monthly": Res = Monthly Case "Year": Res = Yearly End Select -- __________________________________ HTH Bob "Tetsuya Oguma" wrote in message ... Hi everyone, Thanks for Joel and Sheeloo for my previous post. I want to now concatenate a name of enum item and get its value. So, an example is: Enum Periodicity abcWeekly = 52 abcMonthly = 12 abcYearly = 1 End Enum The reason why I want to do this is 1) get user input of "Monthly" and 2) add a prefix of "abc" to get a value of "12"! How can I do that? I tried Application.Evaluate("abc"&"Monthly"), but in vain... Thanks in advance! |
All times are GMT +1. The time now is 07:29 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com