Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2005

Tip: Looking for answers? Try searching our database.

Show content of a variable instead of its name

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
LucaPri - 15 Feb 2005 05:47 GMT
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

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.