Protect HEADER and FOOTER ?

  • Thread starter Thread starter AP
  • Start date Start date
A

AP

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,
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
 
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top