![]() |
MsgBox & String
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\Ron Bowman\My Documents\& sName & sDate & EOM INFO\DATA INPUT." End Sub and I get "C:\Documents and Settings\Ron Bowman\My Documents\& sName & sDate & EOM INFO\DATA INPUT." I do not get the values of sName or sDate. What am I doing wrong? Thanks for any help. |
MsgBox & String
The msgbox will display what ever is between the double
quotes. literally. try this: msgbox "sName: " & sName.value & " " & "sDate: " & sDate.value here i am asking it to display what is between the double quotes but also deplay the values outside the quotes and have join every thing with concatenators. should look like this: sname: namevalue sdate: datevalue you might also like to use vbnewline or chr(13) in the middle to make it look like this: sname: namevalue sdate: datevalue -----Original Message----- 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\Ron Bowman\My Documents\& sName & sDate & EOM INFO\DATA INPUT." End Sub and I get "C:\Documents and Settings\Ron Bowman\My Documents\& sName & sDate & EOM INFO\DATA INPUT." I do not get the values of sName or sDate. What am I doing wrong? Thanks for any help. . |
MsgBox & String
-----Original Message----- You need to a double quote before and after the &s like this MsgBox "C:\Documents and Settings\Ron Bowman\My Documents\" & sName & "sDate & EOM INFO\DATA INPUT." "Ronbo" wrote: 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\Ron Bowman\My Documents\& sName & sDate & EOM INFO\DATA INPUT." End Sub and I get "C:\Documents and Settings\Ron Bowman\My Documents\& sName & sDate & EOM INFO\DATA INPUT." I do not get the values of sName or sDate. What am I doing wrong? Thanks for any help. . Thanks for the help but I still do not get the values. What I now get is; C:\Documents and Settings\Ron Bowman\My Documents\sDate & EOM INFO\DATA INPUT Any other ideas?? |
MsgBox & String
-----Original Message----- The msgbox will display what ever is between the double quotes. literally. try this: msgbox "sName: " & sName.value & " " & "sDate: " & sDate.value here i am asking it to display what is between the double quotes but also deplay the values outside the quotes and have join every thing with concatenators. should look like this: sname: namevalue sdate: datevalue you might also like to use vbnewline or chr(13) in the middle to make it look like this: sname: namevalue sdate: datevalue -----Original Message----- 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\Ron Bowman\My Documents\& sName & sDate & EOM INFO\DATA INPUT." End Sub and I get "C:\Documents and Settings\Ron Bowman\My Documents\& sName & sDate & EOM INFO\DATA INPUT." I do not get the values of sName or sDate. What am I doing wrong? Thanks for any help. . . This gives me an error "Invaild Qualifier" |
All times are GMT +1. The time now is 05:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com