Unable to set the RightHeader property of the PageSetup class.

JohnZ1156

Board Regular
Joined
Apr 10, 2021
Messages
164
Office Version
  1. 2021
Platform
  1. Windows
I'm suddenly getting this error.
Unable to set the RightHeader property of the PageSetup class.

VBA Code:
Sub RegisterHeader()
'   Format Data in Header
    Application.ActiveSheet.PageSetup.LeftHeader = ""
    Application.ActiveSheet.PageSetup.CenterHeader = ""
    Application.ActiveSheet.PageSetup.RightHeader = ""
    Application.ActiveSheet.PageSetup.LeftFooter = ""
    Application.ActiveSheet.PageSetup.CenterFooter = ""
    Application.ActiveSheet.PageSetup.RightFooter = ""

    Application.ActiveSheet.PageSetup.BottomMargin = Application.InchesToPoints(0.5)
    Application.ActiveSheet.PageSetup.TopMargin = Application.InchesToPoints(1)
    
    Application.ActiveSheet.PageSetup.LeftHeader = "&""Arial""&20" & "Printed on " & Format(Date, "m/d/yyyy") & " at " & Format(Time, "h:mm AM/PM") & _
    Chr$(10) & "&16" & "Closing: " & Format(ActiveSheet.Range("H9").Value, "$#,##0.00   ") & "Cleared: " & Format(ActiveSheet.Range("H11").Value, "$#,##0.00   ") & _
    Chr$(10) & "&14" & "W: " & Format(ActiveSheet.Range("D6").Value, "$#,##0.00 ") & "D: " & Format(ActiveSheet.Range("E6").Value, "$#,##0.00")
    
    Application.ActiveSheet.PageSetup.CenterHeader = "&""Arial""&B&I&U&24" & "Bank Check Register" & _
    Chr$(10) & "&B&I&U&20" & "Account: XXXX-XXXXXX"

[B]' These 2 lines are yellow.[/B]
    Application.ActiveSheet.PageSetup.RightHeader = "&""Arial""&20" & "Page &P of &N   " & _
    Chr$(10) & Format(ActiveSheet.Range("J1").Value, "$#,##0.00   ")
    
End Sub
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Googled Error message.
Something having to do with printer drivers.
I closed MS Excel and rebooted my computer.
No error message now.
 
Upvote 0
Solution

Forum statistics

Threads
1,216,070
Messages
6,128,610
Members
449,460
Latest member
jgharbawi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top