Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default 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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default 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.

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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??
  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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"

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change 3 letter text string to a number string Pete Excel Discussion (Misc queries) 3 December 31st 07 07:47 PM
counting the number of instances of a string within another string Keith R Excel Worksheet Functions 3 March 5th 07 06:54 PM
to search for a string and affect data if it finds the string? Shwaman Excel Worksheet Functions 1 January 11th 06 12:56 AM
Can I create a msgbox that is asking for a string to be typed in? Phillips Excel Programming 2 November 20th 03 02:18 AM
Create a formula into a String then assign string to a cell Myrna Larson[_2_] Excel Programming 6 August 23rd 03 09:42 PM


All times are GMT +1. The time now is 09:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"