Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to protect header & footer
Can somebody tell me how I can protect the contents of Header & Footer ?
Many thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to protect header & footer
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to protect header & footer
Tip :
Better change all sheets because it is possible that the user have more sheets selected Here a example http://www.rondebruin.nl/print.htm#Saved -- Regards Ron de Bruin http://www.rondebruin.nl "dominicb" wrote in message ... 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to protect header & footer
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
header footer | Excel Discussion (Misc queries) | |||
Header/Footer | Setting up and Configuration of Excel | |||
Header & Footer | Excel Discussion (Misc queries) | |||
Header and Footer | Excel Discussion (Misc queries) | |||
Changing (Part of) Header Without Changing Footer or Rest of Header | Excel Programming |