Closed Thread
Results 1 to 14 of 14

protect Header and Footer

  1. #1
    Registered User
    Join Date
    06-05-2006
    Posts
    26

    protect Header and Footer

    Is there a way to protect the Header or the Footer from deletion? (or changes) I don't neccessary want to protect the whole sheet.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    Most of the info I've found about this topic says it can't be done, but, you can use vba to set the headers/footers to whatever you want on the BeforePrint event.

    From a post of DominicB in July 2005:
    Please Login or Register  to view this content.
    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.

    Thanks, Dom.

  3. #3
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi Paul

    Your welcome. And thanks for the credit. It's that long since I made that post I could have forgotten all about it.

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  4. #4
    Registered User
    Join Date
    06-05-2006
    Posts
    26
    Thanks pjoaquin, I saw the same thing before my post but I have no idea what VBAis. I am not an expert on Excel. I was hoping something a bit easier to understand. Thanks anyway.

  5. #5
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Quote Originally Posted by tonyk
    Thanks pjoaquin, I saw the same thing before my post but I have no idea what VBAis. I am not an expert on Excel. I was hoping something a bit easier to understand. Thanks anyway.
    Hi tonyk,

    May be this link will help?

    http://www.functionx.com/vbaexcel/index.htm
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  6. #6
    Registered User
    Join Date
    06-05-2006
    Posts
    26
    Thank you oldchippy. This was definitely a more step by step.

  7. #7
    Registered User
    Join Date
    06-05-2006
    Posts
    26
    oldchippy - I went into the link you provided but i didn't understand it. Where and what "Module"/window do I enter the code? Sorry for the late question. It took me 3 days trying to figure it out but with no success.

  8. #8
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    From your spreadsheet, go to Tools > Macros > Visual Basic Editor you will then see

    http://www.functionx.com/vbaexcel/Lesson01.htm

  9. #9
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi tonyk

    OK. Open Excel with just the file you want to affect open - nothing else.
    Press Alt + F11. This will open the VBE - Excel's prpogramming environment.
    Look in the project window (usually top left) for the object called "ThisWorkbook".
    Double click on it.
    This should open up an empty pane to the right. There will be two dropdown boxes containing the words "General" and "Declarations".
    Paste my code that Paul gave you into the empty pane.
    Go to File > Close and Return to Microsoft Excel.
    Save the file as normal.

    Nothing will appear to happen unitl you print, when the print call will be intercepted by your macro and the macro will execute before being printed - in this instance reinstating the header / footer.

    HTH

    DominicB

  10. #10
    Registered User
    Join Date
    06-05-2006
    Posts
    26
    Thank you for the explanation. I did everything but print. I didn't know it wouldn't show under Header and Footer. I wracked my brain out for three days. I might missed that part on my print out. Thanks oldchippy, and dominicb. Great help!

  11. #11
    Registered User
    Join Date
    06-05-2006
    Posts
    26
    dominicb, oldchippy, pjoaquin and helpful others. Since I can't go into header or footer to view, how do edit the entries? I need to change the fonts? Format doesn't have the Font increase in the VBE window. Is there another code for that too?

  12. #12
    Registered User
    Join Date
    08-10-2011
    Location
    Argentina
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: protect Header and Footer

    DominicB, excelent you post. Work fine.

    What i have do if i want to insert a image into de headers / footers ?

    Thanks in advance

    SGA

  13. #13
    Registered User
    Join Date
    06-27-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: protect Header and Footer

    After using the code to protect the footer, how can we enter page number. Is their any code for it?

    Thanks in advance

  14. #14
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: protect Header and Footer

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1