Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Cancel printing a worksheet

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cancel printing a worksheet Johnny W. Excel Worksheet Functions 1 March 4th 10 04:30 PM
Worksheet printing tb New Users to Excel 2 February 25th 10 04:34 PM
Workbook_BeforeClose(Cancel As Boolean) - Cancel won't work gpmichal Setting up and Configuration of Excel 1 May 12th 09 02:33 AM
printing a worksheet Jim Excel Discussion (Misc queries) 2 January 4th 09 06:57 PM
Worksheet printing Laura Excel Worksheet Functions 2 April 19th 07 05:40 PM


All times are GMT +1. The time now is 09:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"