View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
G Lykos G Lykos is offline
external usenet poster
 
Posts: 74
Default How to evaluate VB constant name in string variable?

Thanks. The idea was to avoid having to look up and hard-code a bunch of
system constants that I already know by name. If you can go into the VBE
Immediate window, enter '? vbOK', and get back '1' on the fly, then you'd
think that VBA would be able to handle run-time evaluation of system
constants by name reference within module code. Any other ideas?


"Peter T" <peter_t@discussions wrote in message
...
If s = "vbOK" then
n = 1
elseif
etc

or
Select Case s
Case "vbOK": n = 1
etc

You didn't explain the context of your question, there might be a
different approach.

Regards,
Peter T

"G Lykos" wrote in message
...
Okay - how about vbOK/1. Are you familiar with a mechanism to evaluate
the VB constant name in a string variable?

Thanks!


"Peter T" <peter_t@discussions wrote in message
...
What's the context of your question

vbOkay - no such named constant, maybe you mean vbYes/6 or vbOK/1

Regards,
Peter T

"G Lykos" wrote in message
...
Greetings!

Example: the value of vbOkay within the VBE is 6. {i = vbOkay} yields
i = 6.

Would like a construct where {sMyString = "vbOkay" : i =
UnknownFunction(sMyString)} yields i = 6

TIA!
George