Link to home
Create AccountLog in
Avatar of 1r3o2n8
1r3o2n8Flag for United States of America

asked on

page preview

Wrkbk attached has macro1 which prints oddly.  On page 1, an old center header appears as a center footer.  Other footers are ok.  On page 2,  and maybe more, appears a center footer which I do  not want to appear.  Both of these errors are consistent with code that I have deleted, but the footers still appear.  It seems as though old code still executes, but it has been deleted or commented out.  Macro2 and macro3 are similar and those execute ok. I've tried to bring the good code over to macro1 with negative results.  I appreciate your kind attention to this matter.
PSBWIRE-2010.xlsm
Avatar of TommySzalapski
TommySzalapski
Flag of United States of America image

Just clear them all at the top right under With ActiveSheet
    .PageSetup.LeftHeader = ""
    .PageSetup.CenterHeader = ""
    .PageSetup.RightHeader = ""
    .PageSetup.LeftFooter = ""
    .PageSetup.CenterFooter = ""
    .PageSetup.RightFooter = ""
    .PageSetup.FirstPage.LeftHeader.Text = ""
    .PageSetup.FirstPage.CenterHeader.Text = ""
    .PageSetup.FirstPage.RightHeader.Text = ""
    .PageSetup.FirstPage.LeftFooter.Text = ""
    .PageSetup.FirstPage.CenterFooter.Text = ""
    .PageSetup.FirstPage.RightFooter.Text = ""

Open in new window

Avatar of 1r3o2n8

ASKER

Still doesn't work.  Blo is how I did it:  Thanks for your quick reply!

StOption Explicit     '/mandatory variable declaration before any subs
'''/ Ron Schneider 402-659-2126  ronspeak@hotmail.com

Sub macro1()

'Macro1, 2, 3 got slower and slower as headers and footers were added.  An EE solver had an idea
'about changing printer pseudo name to document writer-how do you name a printer on the network?  ID: 34282443/10
'move data from spreadsheet to "account number" (one of three rpts) sheet.(not from form to sheet)On Error GoTo err_handler
'see code in "WIRE" folder.

On Error GoTo err_handler
                                                           'this is account number
Dim rg As Range             'Other rpts are Originator and Benefactor.
Dim i As Long
Dim LastRow As Integer

Application.EnableEvents = False
Application.ScreenUpdating = False      'makes updating invisible and speeds up macro execution.
''''''''''''''''''''''
With ActiveSheet  'ok here?

    .PageSetup.LeftHeader = ""
    .PageSetup.CenterHeader = ""
    .PageSetup.RightHeader = ""
    .PageSetup.LeftFooter = ""
    .PageSetup.CenterFooter = ""
    .PageSetup.RightFooter = ""
    .PageSetup.FirstPage.LeftHeader.Text = ""
    .PageSetup.FirstPage.CenterHeader.Text = ""
    .PageSetup.FirstPage.RightHeader.Text = ""
    .PageSetup.FirstPage.LeftFooter.Text = ""
    .PageSetup.FirstPage.CenterFooter.Text = ""
    .PageSetup.FirstPage.RightFooter.Text = ""
End With  'ok here?
ASKER CERTIFIED SOLUTION
Avatar of TommySzalapski
TommySzalapski
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of 1r3o2n8

ASKER

Thank you very much for getting me the immediate, correct answer.  I'm just curiou why all this is necessary.
They are left set from the last time you ran the other code. You didn't need quite all those lines and you really should only need to run it once (not every time). But there's no harm in running it every time and it's a good clean block of code that you can reuse over and over.
You could even bundle it into a function if you plan to do this a lot.