Hide / Unhide Workshets on Print and Open
Try this on the Thisworkbook code module:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
'hide the sheets
Sheets("VAV Data").Visible = xlSheetVisible
Sheets("FPB Data").Visible = xlSheetVisible
With Application
.EnableEvents = False
.Dialogs(xlDialogPrint).Show
.EnableEvents = True
End With
'show the sheets
Sheets("VAV Data").Visible = xlSheetVisible
Sheets("FPB Data").Visible = xlSheetVisible
End Sub
Private Sub Workbook_Open()
'show the sheets
Sheets("VAV Data").Visible = xlSheetVisible
Sheets("FPB Data").Visible = xlSheetVisible
End Sub
--
Hope that helps.
Vergel Adriano
"Mr. Matt" wrote:
I have two worksheets in a file that I'd like to unhide when the file is
opened and I'd like to hide them prior to printing since they should not be
printed when "print entire workbook" is chosen. They are named VAV Data and
FPB Data. They may or may not be hidden when the file is closed.
Thanks
|