run macro based on Yes/No

S

Sheila

I have some small macro buttons for printing. There are 12 of them
and they are many pages so I wish to add into the macro (at the start)
the oprion for the user to opt out of running the print macro using a
Yes/No button. Can someone help as to how I can word the macro so
that this will work?

TIA
sheila
 
A

Anders S

Is this what you want?

'----
Sub test()
Dim goOn As Integer
goOn = MsgBox(prompt:="Do you want to continue?", _
Buttons:=vbOKCancel, Title:="Start printing?")
If goOn = vbCancel Then Exit Sub

MsgBox "Continue"
End Sub
'----

HTH
Anders Silvén
 
S

Sheila

Looks good, thanks for that.

sheila


Is this what you want?

'----
Sub test()
Dim goOn As Integer
goOn = MsgBox(prompt:="Do you want to continue?", _
Buttons:=vbOKCancel, Title:="Start printing?")
If goOn = vbCancel Then Exit Sub

MsgBox "Continue"
End Sub
'----

HTH
Anders Silvén
 

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