Consulting

Results 1 to 4 of 4

Thread: Solved: Printing Headers to all sheets on printout?

  1. #1
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location

    Solved: Printing Headers to all sheets on printout?

    Hi all, i am currently using a snippet of code to print a custom header on the activesheet which works fine however i am having trouble adapting it to work with ActiveWorkbook.PrintOut [VBA]ActiveSheet.PageSetup.CenterHeader = "&""Arial,Bold Italic""&14 Line Settings For " & Chr(13) _
    & CB1V[/VBA]CB1V is a combobox value.

    Any ideas?
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  2. #2
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    Simon

    If that's a value from a combobox then you I don't think you can refer to it like that.

    How did you create the combox?

  3. #3
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    Norie the value from the Combobox isn't an issue as the code works fine (the combobox is on a worksheet and the code is run from there along with others!), my only issue is getting the header to printout on all visible sheets, if i print seperate sheets one at a time then i get the header as i need but if i use activeworkbook.printout i only get the header on the first sheet!
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  4. #4
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    I cured it by having the seets in an array and using:
    [vba]
    For Each Sh In Sheets(arr)
    With Sh
    .PageSetup.CenterHeader = "&""Arial,Bold Italic""&14 Line Settings For " & Chr(13) _
    & CB1V
    .PrintOut
    End With
    Next Sh
    [/vba]
    Last edited by Simon Lloyd; 12-09-2007 at 05:40 PM.
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

Posting Permissions

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