+ Reply to Thread
Results 1 to 2 of 2

Define Font of Custom Date in Footer

  1. #1
    Registered User
    Join Date
    10-06-2009
    Location
    Houston, TX
    MS-Off Ver
    Excel 2003
    Posts
    9

    Define Font of Custom Date in Footer

    I've got a macro that formats the font and color of header and footer elements. I would like to use "mmmm yyyy" for the date in the footer. The problem is I can't seem to figure out how to define the font and color for the date. My code is below.

    Sub HeaderFooter()
    '
    ' HeaderFooter Macro
    ' Inserts header and footer information.
    '

    '
    ActiveSheet.PageSetup.LeftFooter = "&""Calibri,Regular""&11&K00-034&P I Energistics Laboratory"
    ActiveSheet.PageSetup.LeftHeader = "&""Calibri,Regular""&11&K00-034Sound Power Calculations : AHRI 880-2008"
    ActiveSheet.PageSetup.RightFooter = Format(Date, "mmmm yyyy")
    End Sub

  2. #2
    Forum Contributor
    Join Date
    07-27-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    198

    Re: Define Font of Custom Date in Footer

    After researching this on the internet, it appears that there is no property available
    in PageSetup to assign a font color in the page header or footer.

    I'm sure my solution crosses the line of being over-kill, but I am presenting it as an
    attempt to show that this is not impossible.

    With help from posts on different internet forums, I put the VBA code together in the
    attached Excel 2003 file. The current date (Now()) is stored in a separate sheet and formatted
    as needed with the desired font color.
    In code, the date is copied, and with borrowed code called PastPicture, the clipboard image
    is pasted into the image object in the same separate sheet.
    Next the image of the date is copied to a temporary chart (more borrowed code) then exported as
    a jpg file. The jpg file is the image placed in the page footer in PageSetup.

    The code must be run whenever the footer date needs to be made current.

    If you try out the attached file, the reference item OLE Autmation must be selected
    in the VBA Editor. You do this by pressing Alt-F11 while viewing a worksheet,
    choose Tools, References, and check the box for OLE Automation if it is not
    already checked.

    All this just to get a colored font in a footer!
    Attached Files Attached Files

+ 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