+ Reply to Thread
Results 1 to 5 of 5

macro to print full path name in footer

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,176

    macro to print full path name in footer

    In Excel 2000, I am using following code to print the full path name current file in my Footer.

    Private Sub Workbook_Open()
        ActiveSheet.PageSetup.LeftFooter = "&8" & ActiveWorkbook.FullName
    End Sub
    The macro works fine. I edit and/or create about 20 different spreadsheets each day and I want to use the same macro everytime without having to create the same code for every workbook.

    Is there a way to do this so I can use over and over? Also, how can I add a button to my toolbar to use this code again and again with one click (if it is possible)?

    Thanks in advance for any comments/help.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    You need to put the macro into your personal macro workbook along with a shortcut (I selected CNTRL + SHFT + F).

    Typically your personal macro book is hidden, so go to Window > Unhide and see if a hidden workbook exists. It has to be unhidden for you to work directly in it.

    Then paste the code you have into a module except replace
    Private Sub Workbook_Open()
        with
    Sub FooterPath ()
    Then while still in the personal workbook, go to Macros>macros>Options and enter your shortcut..
    Then hide your personal workbook again and you can use the shortcut key whenever you want to add a footer to a workbook worksheet.

    Does this work for you?

    ChemistB

  3. #3
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,176
    Ok. I finally figured it out. It only took me 45 minutes to figure out what I was doing. I got a little additional help from following link http://office.microsoft.com/en-us/ex...872961033.aspx. Thanks for getting me started down the correct path.

    One more question. I don't like using the CNTRL + SHFT + F for the macro (to hard to remember). Any suggestions as to how to place this macro on the tool bar would be great.

    Thanks again.

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    View>Toolbars>Customize>Macros
    Grab the custom button and drag it to your tool bar.
    Right click on the button and "Assign Macro"
    Close your customize window.

    ChemistB

  5. #5
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,176
    Works fine. Thanks for your help

+ 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