View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
PC[_2_] PC[_2_] is offline
external usenet poster
 
Posts: 1
Default Referring to a local or global variable or constant dynamically?

Not sure of the technical term for this but an example of
what's stumping me is this:

Say I have three constants:
const CONV_DWEEZIL = 1
const CONV_MOONBUCKET = 2
const CONV_FRANK = 3

and I have write a function that will have an argument
passed with part of the name of a constant (or global
variable) and a value:

I want to be able to reference the correct constant (or
variable etc) by concatanating the strings. I know I've
done it with other packages but can't find the correct
syntax in VBA.

e.g.

function TimesName(ac_Value as currency, as_Name as
string) as currency
TimesName = ac_Value * "CONV_" & as_Name

**** I want this line to act as though it read ---


end function


..