• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1765
  • Last Modified:

Excel VBA Header Footer Control codes

Hello,
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?
0
COPUSER
Asked:
COPUSER
  • 2
  • 2
1 Solution
 
Patrick MatthewsCommented:
   BuildString = "&""" & myFont & ",Regular""&" & myFontSize & _
        myHeaderFooterText
    wksht.PageSetup.RightFooter = BuildString

0
 
COPUSERAuthor Commented:
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.
0
 
Patrick MatthewsCommented:
I have no idea for Powerpoint or Visio.  For Word, it is complicated in that each document
section has its own header/footer.
0
 
COPUSERAuthor Commented:
Thanks, matthewspatrick.  I'll keep digging.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now