Good day all,
I have a print macro that works wonderfully except when my dialog box appears to give the user a printer option and he or she clicks cancel the job prints regardless. How do I get the job to not print when the user cancels out of the printer dialog box?
[vba]Sub PrintReports()
'Turn screen updating off
Application.ScreenUpdating = False
'select printer
Application.Dialogs(xlDialogPrinterSetup).Show
'unhide sheets
Dim wsSheet As Worksheet
For Each wsSheet In ActiveWorkbook.Worksheets
wsSheet.Visible = xlSheetVisible
Next wsSheet
'Print workbook
ActiveWorkbook.PrintOut Copies:=1, Collate:=True
'Turn screen updating back on
Application.ScreenUpdating = True
End Sub
[/vba]
As always, much gratitude!
Cheers!