Consulting

Results 1 to 4 of 4

Thread: Header Problem with "text CC F&B"

  1. #1

    Header Problem with "text CC F&B"

    I have a strange problem.

    I?m trying to create a header. The function is triggered on the beforeprint event.

    It is supposed to write the follwowing Text "Monatsbericht f?r CC F&B".
    I know that I have to put two &s to get one to be displayed.
    However if the line of code executes then I can find "Monatsbericht f?r CC F&F" in the header.

    I recorded a macro to see what Excel does if I manually enter "Monatsbericht f?r CC F&B".
    This is the result: .LeftHeader = "&""MS Sans Serif,Fett""Monatsbericht f?r CC F&&A"
    It puts an A.

    If I do the recording procedure but enter "Monatsbericht f?r CC F&A" Excel records: .LeftHeader = "&""MS Sans Serif,Fett""Monatsbericht f?r CC F&&N"

    Can someone explain this behaviour to me?

    As this code is transferred to many different worksheets where the Header will be created dynamically out of the filename I can not just hardcode the odd solution that Excel gives me.

    I would be grateful for any help.

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    This works for me.....
    [VBA]Sub a()
    With ActiveSheet.PageSetup
    .LeftHeader = "Monatsbericht f?r CC F&&B"
    End With
    End Sub[/VBA]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    Probably && because with & you can connect variables, codeline over multiple lines, ... (I guess)

    Charlize

  4. #4
    @lucas.

    What language are you using? I guess an english one. I use a german one. A wild guess from my side would be that Excel is so smart and translates the &B which is used for bold to the german equivalent fett.

    This results in F instead of B.

    Now how can I avoid this?

Posting Permissions

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