ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   prevent page printout (https://www.excelbanter.com/excel-programming/357426-prevent-page-printout.html)

kurt

prevent page printout
 
Hello

I have been looking in the variabel list to find a variable that
prevent printing out a sheet.

If there isn't any variable to prevent this, does anyone have a good
Idea to prevent print out a sheet???

Anyone know about this

Regards

Kurt


Norman Jones

prevent page printout
 
Hi Kurt,

Try:

'=============
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = ActiveSheet.Name = "Sheet1" '<<==== CHANGE
End Sub
'<<=============

This is workbook event code and should be pasted into the workbook's
ThisWorkbook module *not* a standard module or a sheet module:

Right-click the Excel icon on the worksheet
(or the icon to the left of the File menu if your workbook is maximised)

Select 'View Code' from the menu and paste the code.

Alt-F11 to return to Excel.

---
Regards,
Norman



"kurt" wrote in message
oups.com...
Hello

I have been looking in the variabel list to find a variable that
prevent printing out a sheet.

If there isn't any variable to prevent this, does anyone have a good
Idea to prevent print out a sheet???

Anyone know about this

Regards

Kurt




Papou

prevent page printout
 
Hello
You can try this workbook event:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then Cancel = True
End Sub

HTH
Cordially
Pascal




All times are GMT +1. The time now is 10:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com