Results 1 to 4 of 4
  1. #1
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Special format codes in header (2000)

    I have been using VBA to set page headers, and am trying to incorporate some of the "special" formatting codes. For instance,
    "&14Some text" will set the header to read "Some text" in 14 point font. I'm having trouble with some other codes though.

    The help file says that &B will turn bold on or off. It only seems to turn it on when I use it.

    The code to set the font is
    & "fontname" (note the space after the ampersand)

    The fontname is supposed to be in double quotes. I've tried all manner of including this code, setting to "Arial", with no success - with and without the space character, the quote marks, inside & outside the header text ...

    Could somebody please give an example of how to use these codes properly?

    thanks

    Alan

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Special format codes in header (2000)

    I recorded this macro while setting a custom header:

    <pre> .LeftHeader = "&""Courier New,Regular""&14this is a test"
    .CenterHeader = "&""Arial,Bold Italic""&10This is another test" & Chr(10) & "&P&T"
    .RightHeader = "&""Arial Black,Italic""&10Final test"
    </pre>


    Any help?
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Special format codes in header (2000)

    Sure is. Wish I'd thought of using the recorder myself :-) I'd forgotten about it after so much VBA <blush>

    This code shows the correct formatting of the formatting codes. I'd have never stumbled on these from the information given in the Help file. Thanks as always Jan.

    Alan

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Special format codes in header (2000)

    Well, since I'm a lazy person <img src=/S/snore.gif border=0 alt=snore width=32 height=15> , I still sometimes use the recorder <img src=/S/smile.gif border=0 alt=smile width=15 height=15> .
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

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