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

P

Pank

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.
 
M

Mike

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
 
B

Bob Phillips

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)
 
J

Jim Jackson

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.
 
P

Pank

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)
 

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

Top