MsgBox String 2

R

Ronbo

How do I get a MsgBox to display the value of a string
rather then the string name?
i.e.

Dim sName As String, sDate As String

sName = (Left(Range("B1"), 4))
sDate = "" & Format(DateSerial(Year(Date), Month
(Date) - 1, 1), " mmm yy ")

MsgBox "C:\Documents and Settings\UserName\My
Documents\& sName & sDate & EOM INFO\DATA INPUT."

End Sub

and I get "C:\Documents and Settings\UserName\My
Documents\& sName & sDate & EOM INFO\DATA INPUT."

I do not get the values of sName or sDate.

What am I doing wrong?

Thanks to Jim and Frank for their ideas. However using
Franks = "Invalid Qualifier" and Jim's = C:\Documents and
Settings\UserName\MyDocuments\sDate & EOM INFO\DATA INPUT

Thanks for any help.
 
H

Harald Staff

By NOT having it somewhere between a couple of quotes. Try this:

Sub test()
Dim S As String
Dim L As Long

S = " fish for sale"
L = 400

MsgBox L & S
MsgBox "L" & S
MsgBox L & "S"
MsgBox "L" & "S"
MsgBox "L & S"

End Sub

HTH. Best wishes Harald
 
D

Doug Glancy

Ronbo,

Try this:

MsgBox "C:\Documents and Settings\UserName\My
Documents\" & sName & sDate & "EOM INFO\DATA INPUT."

hth,

Doug Glancy
 
G

Guest

change Jims from:
MsgBox "C:\Documents and Settings\Ron Bowman\My
Documents\" & sName & "sDate & EOM INFO\DATA INPUT."
to
MsgBox "C:\Documents and Settings\Ron Bowman\My
Documents\" & sName & sDate & " EOM INFO\DATA INPUT."
 
G

Guest

-----Original Message-----
Ronbo,

Try this:

MsgBox "C:\Documents and Settings\UserName\My
Documents\" & sName & sDate & "EOM INFO\DATA INPUT."

hth,

Doug Glancy




.
Thanks a lot for your help. It works!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

MsgBox & String 3
Path and File Name 3
MsgBox & String 3 2
Import Data 1
Named Range maker code 9
Count difference in days input box 4
Automatic date formating 2
Finding Date in an overseas format 20

Top