How do I format a MSGBOX to show text and variables in a macro?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a macro that receives a variable that is input by a user (&rsp1)

I want a MsgBox to display “Do you want to print off the data for “and the
variable &rsp1.

The MsgBox lookes like:-

MsgBox "Do you want to print off the data for &rsp1 - 1?", vbYesNo, "Do you
want to Print offâ€

Additionally, if I know the location of a particular file, how do I
incorporate an open to it?

Any assistance offered will be appreciated.
 
I'm not sure i ub=nderstand the second part of your question but try this for
the first bit.

Sub givemesomeinput()
rsp1 = InputBox("Respond please?", vbYesNo)
msg = " Do you want to print off the data for " & rsp1
MsgBox (msg)
End Sub
 
MsgBox "Do you want to print off the data for " & rsp1 & "- 1?", _
vbYesNo, "Do you want to Print off"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
MsgBox("Do you want to print off the data for " &rsp1 - 1?), vbYesNo
If MsgBox = vbNo then
'Skip over the print command and go to next line of code.


Workbooks.open("C:\MyDocuments\ExcelFiles\MyFilename.xls")

You will be prompted for Update Links?, ReadOnly? etc. You can ignore these
unless you need the file to update links etc.
 
Thanks guys, just what the Doctor ordered.


Bob Phillips said:
MsgBox "Do you want to print off the data for " & rsp1 & "- 1?", _
vbYesNo, "Do you want to Print off"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Back
Top