Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default how to protect header & footer

Can somebody tell me how I can protect the contents of Header & Footer ?
Many thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
header footer CW Excel Discussion (Misc queries) 3 July 17th 09 12:10 AM
Header/Footer General JP Setting up and Configuration of Excel 2 April 2nd 09 04:08 AM
Header & Footer JJ Excel Discussion (Misc queries) 2 December 4th 08 04:40 PM
Header and Footer Jav Excel Discussion (Misc queries) 2 August 11th 05 02:33 PM
Changing (Part of) Header Without Changing Footer or Rest of Header Paul Cross Excel Programming 3 May 20th 04 10:42 PM


All times are GMT +1. The time now is 06:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"