+ Reply to Thread
Results 1 to 7 of 7

How to share header code w/ office

  1. #1
    Registered User
    Join Date
    04-06-2011
    Location
    Chapel Hill, nc
    MS-Off Ver
    Excel 2007
    Posts
    2

    How to share header code w/ office

    I have been using a BeforePrint command to put a header/footer on all my workbooks. I would like everyone in the office to use this and would like to make it as user friendly as possible. I currently a+F11 and paste it into new docs. I'd like to be able to assign a shortcut to it, but I am not sure how to alter it so that
    a) it will work with a shortcut and
    b) so that it can be easily shared with other users.

    The code i pieced together:
    Please Login or Register  to view this content.
    Thanks in advance.
    Last edited by romperstomper; 04-06-2011 at 10:29 AM. Reason: add tags

  2. #2
    Valued Forum Contributor jwright650's Avatar
    Join Date
    12-10-2010
    Location
    Va, USA
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    606

    Re: How to share header code w/ office

    Welcome to the forum.
    Just a quick note, the forum rules require [ code] your code[/code]....type of tags around your code when you post it in the forum.
    ....just letting you know because the mods are pretty strict about the rules.
    Life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.
    John Wright

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,009

    Re: How to share header code w/ office


    I added them as it's the OP's first post.
    Everyone who confuses correlation and causation ends up dead.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,009

    Re: How to share header code w/ office

    You will need an addin with an Application variable declared WithEvents so that you can trap the BeforePrint event of any workbook without having to copy the code into all of them.

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,009

    Re: How to share header code w/ office

    See attached.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-06-2011
    Location
    Chapel Hill, nc
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: How to share header code w/ office

    Thanks for the quick response and will post code properly next go.
    Can you educate me very briefly in high level laymans terms as to the difference between using the add-in vs the macro approach?

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,009

    Re: How to share header code w/ office

    Your macro has to be put into every workbook that you want it to work for. The add-in version monitors the application waiting for any workbook to be printed and then automatically sets its headers as specified.

+ Reply to 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