Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default How to prevent a specific worksheet from being printed !

Hi all,

I have used the following code but this assumes the specific WorkSheet is
the active WorkSheet which is not necessarly always the case.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
MsgBox " Printing Cancelled!"
Cancel = True
End If
End Sub


Any ideas ?

Regards.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default How to prevent a specific worksheet from being printed !

set the printarea for the sheet to an empty range?


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


RAFAAJ2000 wrote :

Hi all,

I have used the following code but this assumes the specific
WorkSheet is the active WorkSheet which is not necessarly always the
case.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
MsgBox " Printing Cancelled!"
Cancel = True
End If
End Sub


Any ideas ?

Regards.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default How to prevent a specific worksheet from being printed !

Clever trick KeepItcool :)

Thanks everyone else.

Jaafar.



"keepITcool" wrote:

set the printarea for the sheet to an empty range?


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


RAFAAJ2000 wrote :

Hi all,

I have used the following code but this assumes the specific
WorkSheet is the active WorkSheet which is not necessarly always the
case.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
MsgBox " Printing Cancelled!"
Cancel = True
End If
End Sub


Any ideas ?

Regards.


  #4   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default How to prevent a specific worksheet from being printed !

I take it your question is how to test to see if a different worksheet (other
than the active sheet is being printed).

I believe when you print, the sheet being printed is the active sheet
(temporarily). Anytime you run a macro to print worksheets (and leave
screenupdating on) you'll see excel activating and looping through the
various worksheets.


"RAFAAJ2000" wrote:

Hi all,

I have used the following code but this assumes the specific WorkSheet is
the active WorkSheet which is not necessarly always the case.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
MsgBox " Printing Cancelled!"
Cancel = True
End If
End Sub


Any ideas ?

Regards.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default How to prevent a specific worksheet from being printed !

What if they say print entire workbook? Can you stop them from doing this
(since, obviously, this will include the active sheet which is undesirable
for printing?)
"JMB" wrote in message
...
I take it your question is how to test to see if a different worksheet
(other
than the active sheet is being printed).

I believe when you print, the sheet being printed is the active sheet
(temporarily). Anytime you run a macro to print worksheets (and leave
screenupdating on) you'll see excel activating and looping through the
various worksheets.


"RAFAAJ2000" wrote:

Hi all,

I have used the following code but this assumes the specific WorkSheet is
the active WorkSheet which is not necessarly always the case.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
MsgBox " Printing Cancelled!"
Cancel = True
End If
End Sub


Any ideas ?

Regards.






  #6   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default How to prevent a specific worksheet from being printed !

hmmm....then it does not appear to work. : )

definitely go with changing the printarea to a single empty cell (it looks
like the printer just spits out a blank page. i can't think of anything else
that would not be more trouble than it's worth. it would be nice to have an
after_print event handler.

thanks for pointing that out.

"William Benson" wrote:

What if they say print entire workbook? Can you stop them from doing this
(since, obviously, this will include the active sheet which is undesirable
for printing?)
"JMB" wrote in message
...
I take it your question is how to test to see if a different worksheet
(other
than the active sheet is being printed).

I believe when you print, the sheet being printed is the active sheet
(temporarily). Anytime you run a macro to print worksheets (and leave
screenupdating on) you'll see excel activating and looping through the
various worksheets.


"RAFAAJ2000" wrote:

Hi all,

I have used the following code but this assumes the specific WorkSheet is
the active WorkSheet which is not necessarly always the case.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
MsgBox " Printing Cancelled!"
Cancel = True
End If
End Sub


Any ideas ?

Regards.





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default How to prevent a specific worksheet from being printed !

I have never printed entire workbook in my life -- except maybe by accident
.... but for some goshdarn reason my boss's boss always did, and he nearly
took my head off when one of the pages was not formatted for it ...


"JMB" wrote in message
...
hmmm....then it does not appear to work. : )

definitely go with changing the printarea to a single empty cell (it looks
like the printer just spits out a blank page. i can't think of anything
else
that would not be more trouble than it's worth. it would be nice to have
an
after_print event handler.

thanks for pointing that out.

"William Benson" wrote:

What if they say print entire workbook? Can you stop them from doing this
(since, obviously, this will include the active sheet which is
undesirable
for printing?)
"JMB" wrote in message
...
I take it your question is how to test to see if a different worksheet
(other
than the active sheet is being printed).

I believe when you print, the sheet being printed is the active sheet
(temporarily). Anytime you run a macro to print worksheets (and leave
screenupdating on) you'll see excel activating and looping through the
various worksheets.


"RAFAAJ2000" wrote:

Hi all,

I have used the following code but this assumes the specific WorkSheet
is
the active WorkSheet which is not necessarly always the case.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
MsgBox " Printing Cancelled!"
Cancel = True
End If
End Sub


Any ideas ?

Regards.







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
How to show date printed, updated only when worksheet printed? Sam Excel Discussion (Misc queries) 4 April 4th 23 10:49 AM
How can I prevent file from being saved or printed in Excel? ProfReggie Setting up and Configuration of Excel 1 May 4th 09 11:43 PM
How to prevent editing within a specific cells? Eric Excel Discussion (Misc queries) 1 October 24th 08 05:17 AM
Prevent Printing of Specific Cells Ken Mitchell Excel Discussion (Misc queries) 5 May 16th 06 07:26 PM
can you prevent viewing of specific columns in a worksheet Tamara Excel Worksheet Functions 1 January 19th 05 04:12 PM


All times are GMT +1. The time now is 06:05 AM.

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

About Us

"It's about Microsoft Excel"