I would like to solve a general problem in VBA (Word 2003, as well as Excel
2003):
Public Const Msg_01 = "Hello World"
Public Const Msg_02 = "Hello Universe"
....
Sub Test()
MsgNo = "01"
X = "Msg_" & MsgNo
'How can I show now the content of the variable ("Hello world")
instead of the name ("Msg_01")?
MsgBox X
End Sub
Thanx in advance
LUCA
Jezebel - 15 Feb 2005 06:12 GMT
You can't. VBA can't manipulate the *names* of variables at all. Use an
array --
Private Msg(1 to 2) as string
Sub Initialize()
Msg(1) = "Hello World"
Msg(2) = "Hello Universe"
End Sub
MsgNo = 1
MsgBox Msg(MsgNo)
>I would like to solve a general problem in VBA (Word 2003, as well as Excel
> 2003):
[quoted text clipped - 16 lines]
> Thanx in advance
> LUCA