Thanks for your answer. I was aware of the event beforeprint, but settings
the header and footer is a very slow process in Excel. Therefore I would have
prefer to disable access to footer and header.
Anyway Thanks.
"dominicb" wrote:
Food afternoon Francois
As regulars to these groups are aware, securely protecting contents of
Excel spreadsheets is impossible. However the code below will not
prevent users from changing the headers, but will reset the headers /
footers to what you decide prior to printing.
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup
.LeftHeader = "header"
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = "footer"
.CenterFooter = ""
.RightFooter = ""
End With
End Sub
Place your headers / footers between the quotes above, empty quotes
will remove any header or footer that has been inserted. As the
procedure uses events it needs placing in the ThisWorkbook pane of the
VBE.
HTH
DominicB
--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=388326