Hi all,
I've tried putting a macro in my workbook so that it doesn't print the first sheet when you hit 'print all active worksheets' in the print dialog box. Whilst it works for sending it to a printer it sometimes returns an error when printing to PDF. Any ideas?
The code I've used is:
Many thanks,
Jon
I've tried putting a macro in my workbook so that it doesn't print the first sheet when you hit 'print all active worksheets' in the print dialog box. Whilst it works for sending it to a printer it sometimes returns an error when printing to PDF. Any ideas?
The code I've used is:
Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
On Error GoTo errhandler
Application.DisplayAlerts = False
Application.EnableEvents = False
ThisWorkbook.Worksheets("Setup").Visible = xlVeryHidden
Application.Dialogs(xlDialogPrint).Show
ThisWorkbook.Worksheets("Setup").Visible = xlSheetVisible
Application.DisplayAlerts = True
Application.EnableEvents = True
Cancel = True
Exit Sub
errhandler:
MsgBox "Print Error, Unable To Print", vbCritical
Application.DisplayAlerts = True
Application.EnableEvents = True
End Sub
Many thanks,
Jon
Last edited by a moderator: