J
Johnny W.
Actually, I've tried printing by selecting the workbook icon and
printing in the blocked sheet and the entire workbook, I've right
clicked on a tab and selected all sheets, I've tried to print when the
blocked sheet is the activesheet, and I've selected the "Entire
workbook" radio button when any sheet is active, and in all cases
Sheet1 does not print. Perhaps I've missed another means to print the
entire workbook or the one worksheet. Is there another way to print
the whole workbook or a particular worksheet that I have not tested?
The code below also works the same without having to identify other
worksheets that may be part of the workbook.
I've been using these two (2) procedures for some time now in Office 3
and they seem to function as I had desired. I've only recently
upgraded to Office 7 on a couple of my computers and haven't tried in
that environment yet.
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
MsgBox "Print Error, Unable to Print Sheet1", vbCritical
Cancel = True
Else
Application.DisplayAlerts = False
Application.EnableEvents = False
ThisWorkbook.Worksheets("Sheet1").Visible = xlVeryHidden
Application.Dialogs(xlDialogPrint).Show
ThisWorkbook.Worksheets("Sheet1").Visible = xlSheetVisible
Application.DisplayAlerts = True
Application.EnableEvents = True
Cancel = True
End If
End Sub
printing in the blocked sheet and the entire workbook, I've right
clicked on a tab and selected all sheets, I've tried to print when the
blocked sheet is the activesheet, and I've selected the "Entire
workbook" radio button when any sheet is active, and in all cases
Sheet1 does not print. Perhaps I've missed another means to print the
entire workbook or the one worksheet. Is there another way to print
the whole workbook or a particular worksheet that I have not tested?
The code below also works the same without having to identify other
worksheets that may be part of the workbook.
I've been using these two (2) procedures for some time now in Office 3
and they seem to function as I had desired. I've only recently
upgraded to Office 7 on a couple of my computers and haven't tried in
that environment yet.
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
MsgBox "Print Error, Unable to Print Sheet1", vbCritical
Cancel = True
Else
Application.DisplayAlerts = False
Application.EnableEvents = False
ThisWorkbook.Worksheets("Sheet1").Visible = xlVeryHidden
Application.Dialogs(xlDialogPrint).Show
ThisWorkbook.Worksheets("Sheet1").Visible = xlSheetVisible
Application.DisplayAlerts = True
Application.EnableEvents = True
Cancel = True
End If
End Sub