p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Excel VBA (http://p2p.wrox.com/forumdisplay.php?f=79)
-   -   Excel Header Font (http://p2p.wrox.com/showthread.php?t=7283)

nnmmss December 16th, 2003 03:24 AM

Excel Header Font
how can i access the header font and size in header section of my excel via Visual basic?

gcianfanelli December 16th, 2003 05:25 AM

You can set the font name/size by setting a string value such as

 &"Arial"&8 My Header

ActiveWorkbook.Worksheets(1).PageSetup.LeftHeader = "&""Arial""&8 My Header"

this sets the left-hand header to "My Header" in Arial 8 point

NekMoth March 26th, 2007 09:53 PM

this was helpful...

However, how do you implement a string variable?

the following is a snippet from a macro I wrote:


Application.Worksheets("sheet1").PageSetup.LeftHeader = _
        "&""Arial,bold""&15""&  " & Worksheets("sheet2").Range("A1").Value

this seems to work (correct font and size) except that whatever the ("A1").value is it will print that preceded by a quotation mark (ie... "myvalue )

I have tried various combos within the syntax, but this is as close as I can get. I should note that the value mentioned is a number, just in case that may mean something.

any suggestions?
any help is greatly appreicated.

NekMoth March 28th, 2007 03:15 PM

found the solution:



All times are GMT -4. The time now is 06:06 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.