Excel VBA Header Footer Control codes

Posted on 2007-10-08
Last Modified: 2013-01-21
I'm trying to programmatically insert header and footer information in Excel.  If I have the following input variables identified, what would be the correct syntex to use?
myFont, myFontSize, myHeaderFooterText

I've tried the following and it did not work.
    BuildString = Chr(34) & "&" & Chr(34) & Chr(34) & myFont & " Chr(34) & Chr(34) & "&"_    
                          & myFontSize & myHeaderFooterText & Chr(34)
    wksht.PageSetup.RightFooter = BuildString

Can someone help?
Question by:COPUSER
    LVL 92

    Accepted Solution

       BuildString = "&""" & myFont & ",Regular""&" & myFontSize & _
        wksht.PageSetup.RightFooter = BuildString


    Author Comment

    Thanks, matthewspatrick.  It worked.  I have another proposition.  I need to do somthing similar to other Microsoft Office apps: Word, Powerpoint, and Visio.  For additional 250 points, can you provide me additional code examples?  Much appreciated.
    LVL 92

    Expert Comment

    by:Patrick Matthews
    I have no idea for Powerpoint or Visio.  For Word, it is complicated in that each document
    section has its own header/footer.

    Author Comment

    Thanks, matthewspatrick.  I'll keep digging.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    In case Office 2010 has not been deployed in your environment, this article may be quite useful. In our office, we wanted a way to deploy Microsoft Office Professional Plus 2010 through an automated batch file via logon script. This article is docum…
    This article will show you how to use shortcut menus in the Access run-time environment.
    This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now