Consulting

Results 1 to 5 of 5

Thread: Solved: VBA To insert File Path Footer at bottom of each sheet

  1. #1
    VBAX Regular
    Joined
    Jun 2007
    Posts
    37
    Location

    Solved: VBA To insert File Path Footer at bottom of each sheet

    Hi, I have this code which inserts the File Path as a footer on each page of the selected sheet:

    [vba]Sub Footer()
    '
    ' footer Macro
    ' Macro recorded 13/06/2007 by xazz
    '
    '
    With ActiveSheet.PageSetup
    .LeftHeader = ""
    .CenterHeader = ""
    .RightHeader = ""
    .LeftFooter = ""
    .CenterFooter = "&Z&F"
    .RightFooter = ""
    .LeftMargin = Application.InchesToPoints(0.15748031496063)
    .RightMargin = Application.InchesToPoints(0.15748031496063)
    .TopMargin = Application.InchesToPoints(0.78740157480315)
    .BottomMargin = Application.InchesToPoints(0.78740157480315)
    .HeaderMargin = Application.InchesToPoints(0.31496062992126)
    .FooterMargin = Application.InchesToPoints(0.31496062992126)
    .PrintHeadings = False
    .PrintGridlines = False
    .PrintComments = xlPrintNoComments
    .PrintQuality = 600
    .CenterHorizontally = False
    .CenterVertically = False
    .Orientation = xlLandscape
    .Draft = False
    .PaperSize = xlPaperA4
    .FirstPageNumber = xlAutomatic
    .Order = xlDownThenOver
    .BlackAndWhite = False
    .Zoom = False
    .FitToPagesWide = 1
    .FitToPagesTall = False
    .PrintErrors = xlPrintErrorsDisplayed
    End With
    End Sub
    [/vba]

    what I would like to do is get the code to put the file path footer at the bottom of every page of every worksheet. I'm close but need help...
    Thanks All...

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    [vba]
    Sub Footer()
    Dim sh As Worksheet
    For Each sh In Worksheets
    sh.PageSetup.CenterFooter = "&Z&F"
    Next
    End Sub

    [/vba]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    BTW,
    Unless you are changing the default settings in your code, delete all the superfluous lines, keeping only the code change that you need.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    If you mean to show the sheet or tab too:
    [VBA].CenterFooter = "&Z&F!&A"[/VBA]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    VBAX Regular
    Joined
    Jun 2007
    Posts
    37
    Location
    Thanks mdmackillop & lucas worked perfectly!

Posting Permissions

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