Unable to set the RightHeader property of the PageSetup class.

JohnZ1156

Board Regular
Joined
Apr 10, 2021
Messages
180
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

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
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,223,157
Messages
6,170,419
Members
452,325
Latest member
BlahQz

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