ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB Msgbox result (https://www.excelbanter.com/excel-programming/413597-vbulletin-msgbox-result.html)

Rich[_2_]

VB Msgbox result
 
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

Dave Peterson

VB Msgbox result
 
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



Rich wrote:

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


--

Dave Peterson


All times are GMT +1. The time now is 12:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com