ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protect HEADER and FOOTER ? (https://www.excelbanter.com/excel-programming/361040-protect-header-footer.html)

AP[_3_]

Protect HEADER and FOOTER ?
 
Although I've protected the worksheet, users can still edit the HEADER and
FOOTER.

Is there code or any other way of protecting the HEADER and FOOTER from
being edited ?

Thanks very much for your help.

AP



NickHK

Protect HEADER and FOOTER ?
 
AP,
As far as I can tell, protection (in XL2K) does not cover the header/footer.
But you could respond in the Workbook_BeforePrint event to set them to
whatever you want.
This events fires on PrintPreview as well as actual printing, so an
incorrect header/footer would never actually be seen.

NickHK

"AP" wrote in message
...
Although I've protected the worksheet, users can still edit the HEADER and
FOOTER.

Is there code or any other way of protecting the HEADER and FOOTER from
being edited ?

Thanks very much for your help.

AP





AP[_3_]

Protect HEADER and FOOTER ?
 
Nick,

Thanks for the response. What I find is that in the print preview mode, the
user can click on "Print..." and manually change the headers and footers
(despite the Workbook_BeforePrint event subroutine) and then print exactly
the changed header/footer without the subroutine having the chance to
interfere further.

Any ideas on how this might be overcome?

Thanks,
AP

"NickHK" wrote in message
...
AP,
As far as I can tell, protection (in XL2K) does not cover the
header/footer.
But you could respond in the Workbook_BeforePrint event to set them to
whatever you want.
This events fires on PrintPreview as well as actual printing, so an
incorrect header/footer would never actually be seen.

NickHK

"AP" wrote in message
...
Although I've protected the worksheet, users can still edit the HEADER
and
FOOTER.

Is there code or any other way of protecting the HEADER and FOOTER from
being edited ?

Thanks very much for your help.

AP







NickHK

Protect HEADER and FOOTER ?
 
AP,
This works for me for Print Preview and then Print:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
MsgBox "Before print event fired"

With ActiveSheet.PageSetup
.LeftHeader = "Only this text allowed."
'And anything further
End With
End Sub

NickHK

P.S. It's probably a good idea to set your print to a PDF or similar, so you
do print page after page of rubbish whilst testing this.


"AP" wrote in message
...
Nick,

Thanks for the response. What I find is that in the print preview mode,

the
user can click on "Print..." and manually change the headers and footers
(despite the Workbook_BeforePrint event subroutine) and then print exactly
the changed header/footer without the subroutine having the chance to
interfere further.

Any ideas on how this might be overcome?

Thanks,
AP

"NickHK" wrote in message
...
AP,
As far as I can tell, protection (in XL2K) does not cover the
header/footer.
But you could respond in the Workbook_BeforePrint event to set them to
whatever you want.
This events fires on PrintPreview as well as actual printing, so an
incorrect header/footer would never actually be seen.

NickHK

"AP" wrote in message
...
Although I've protected the worksheet, users can still edit the HEADER
and
FOOTER.

Is there code or any other way of protecting the HEADER and FOOTER from
being edited ?

Thanks very much for your help.

AP










All times are GMT +1. The time now is 07:04 PM.

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