I have created few Constants (VBA identifiers declared with the key word Const) that look like Rg_Euro, Rg_Usd, Rg_Cad, ... to define specific regions into my workbook.
As I have these "extensions" (Euro, Usd, Cad, ...) in the DataBase that I'm working with, I tried to get the values of my constant by creating a string like this : Str = "Rg_" & extension(i)
But I can't seem to find a workaround to call the Constant and get its value from it... I'm googled it but didn't found what I was looking for and I'm starting to think that it might not be possible directly...
I thought of a User Defined Function with a Select Case on the String to return the right value, but it is just going to add another function, so I'm looking for a more direct solution if there is one!
Const? If so -- I don't see how you can do much better than using select case or a dictionary. Wrapping it in a function is a sign of good programming rather than bad programming. If by constant you mean entries in the workbook's Names collection (named ranges or named values) then it is easy to access them from string variables.Constvariables declared in VBA, I know the others are accessible viaListObject... For the function, I know it is still a good solution but I was wondering if there was a more direct way to do this, even if it apparently does not.