VB Msgbox result

R

Rich

Sub Print_All_Sections()
'
' Print_All_Sections Macro
' Macro recorded 05/07/2008 by Log-In
'
' Keyboard Shortcut: Ctrl+p

MsgBox "This Will Print All Sections Sheets", vbYesNo
If vbresponce = No Then Exit Sub

Sheets(Array("Not Here", "transport", "forklift", "Carousel", "B & L",
"C & D", _
"Managers", "Admin", "Tipping", "E", "F", "G", "H", "W W
Irish")).Select
Sheets("W W Irish").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Control").Select
ActiveWindow.SmallScroll Down:=-12
End Sub


want the code to cancel printing if no is clicked but print all if yes is
clicked but its not playing

any ideas
 
D

Dave Peterson

Maybe...

Option Explicit
Sub Print_All_Sections()

dim Resp as long

resp = MsgBox(prompt:="This Will Print All Sections Sheets", _
buttons:=vbYesNo)

If resp = vbNo Then
Exit Sub
End if

Sheets(Array("Not Here", "transport", "forklift", "Carousel", "B & L", _
"C & D", "Managers", "Admin", "Tipping", "E", "F", "G", _
"H", "W W Irish")).printout Copies:=1, Collate:=True

End Sub
 

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