CenterHeader in PrinterSetup (vba code)

  • I recorded a macro to set my printer settings. I then incorporated this macro into my vba code.
    I pass two variables to this routine, my print area and the Header I want printed on the top of the page.
    I have a user form that allows the user to select 1 of 3 buttons. Each button selectrs a different Header Name.
    My code opens another spreadsheet and pulls names from that other spreadsheet then prompts the user as to print or not. When they say Print, my PrintSetup routine runs.

    The first time I run this, the Header prints as expected but, if I then click on one of the other buttons, the header does not change.
    When I step through this code, I press f8 to move 1 or 2 lines past the .CenterHeader = ReportHeader (my variable) and then I press f5 and the Header will be updated properly.

    Any ideas what could be causing this?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!