using VBA to print Header & footer

Discussion in 'Microsoft Excel Discussion' started by nickbest_l_10@hotmail.com, Nov 28, 2011.

  1. Guest

    Hi,
    What VBA code should I use in a worksheet so it will print a header &
    Footer?
     
    , Nov 28, 2011
    #1
    1. Advertisements

  2. Don Guillett Guest

    On Nov 28, 12:43 pm, wrote:
    > Hi,
    > What VBA code should I use in a worksheet so it will print a header &
    > Footer?


    Have you tried doing it manually while recording a macro...??
     
    Don Guillett, Nov 28, 2011
    #2
    1. Advertisements

  3. Guest

    On Nov 28, 9:29 pm, Don Guillett <> wrote:
    > On Nov 28, 12:43 pm, wrote:
    >
    > > Hi,
    > > What VBA code should I use in a worksheet so it will print a header &
    > > Footer?

    >
    > Have you tried doing it manually while recording a macro...??


    I recorded a macro but it did not show it when print preview or when
    printing.

    To explane the idea more:
    If I go to the page setup menu, header & Footer and add the custom
    header i want, it stays there and can be seen when printing it.

    Can these steps be done using VBA code?
     
    , Nov 29, 2011
    #3
  4. Guest

    On Nov 29, 11:30 pm, dave y. <> wrote:
    > On Tue, 29 Nov 2011 08:42:20 -0800 (PST),
    > wrote:
    >
    >
    >
    >
    >
    > >On Nov 28, 9:29 pm, Don Guillett <> wrote:
    > >> On Nov 28, 12:43 pm, wrote:

    >
    > >> > Hi,
    > >> > What VBA code should I use in a worksheet so it will print a header &
    > >> > Footer?

    >
    > >> Have you tried doing it manually while recording a macro...??

    >
    > >I recorded a macro but it did not show it when print preview or when
    > >printing.

    >
    > >To explane the idea more:
    > >If I go to the page setup menu, header & Footer and add the custom
    > >header i want, it stays there and can be seen when printing it.

    >
    > >Can these steps be done using VBA code?

    >
    > The following should do the trick:
    >
    >     Sub Add_Header_Footer()
    >     With ActiveSheet.PageSetup
    >         .LeftHeader = "My Left Header"
    >         .CenterHeader = "My Center Header"
    >         .RightHeader = "My Right Header"
    >         .LeftFooter = "My Left Header"
    >         .CenterFooter = "My Center Footer"
    >         .RightFooter = "My Right Footer"
    >     End With
    >     End Sub
    >
    > dave y.- Hide quoted text -
    >
    > - Show quoted text -



    Thanks Dave,
    I am almost there.
    My left header is a picture (\stone\L_Logo.tif) and is in the same
    folder as the Excel file.
    I did not succeed to have the picture shown!
    How can it be done? What should I put after the equal sign in
    the .LeftHeader line?
     
    , Nov 30, 2011
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.