Header text across the page error

matthj

New Member
Joined
Feb 22, 2008
Messages
4
First time post.
Hope someone can help.
My workbook prints different type of reports. One of the reports requires a header. I seem to get nearly all the header printing as required but I need to have 4 headings going across the page. The number of pages can vary. The following is run in a Public Sub.

With Worksheets("P").PageSetup
.PrintArea = "A14:D" & lastCSrow
.Orientation = xlLandscape
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.3)
.TopMargin = Application.InchesToPoints(2.5)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)

.LeftHeader = "&""Arial,Black""&36 NAME SCOPE OF WORKS" & _
Chr(10) & "&""Arial,Black ""&14 Project :=" & proj & Chr(10) _
& "&""Arial,Black ""&14 CS No := " & CSnum & Chr(10) & _
"&""Arial,Black ""&14 Lift No := " & LiftNo & Chr(10) & _
"&""Arial,Black ""&14 Load := " & load & Chr(10) & "Items _ Changes Vendor Comments"

End With
Worksheets("P").PrintOut , preview:=True

I get a Error '1004' . Unable to set the LeftHeader property for the PageSetup class.

This appears due to the distance between 'Items, Changes, Vendor and Comments. How can I get these to print across the bottom of the header at the locations I want.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
i just put in .PrintArea = "A14:D1" & lastCSrow
you had .PrintArea = "A14:D" & lastCSrow

or this will work .PrintArea = "A14:D" & xlLastCell
 
Upvote 0
and all so "&""Arial,Black ""&14 Load := " & Chr(10) & "Items _ Changes Vendor Comments"


yours = "&""Arial,Black ""&14 Load := " & Load & Chr(10) & "Items _ Changes Vendor Comments"
 
Upvote 0
Diablo II. Thanks for the reply. Sorry for delay in getting back to you.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
Unfortunately I still seem to have the problem. I did think that using Load as a variable name might have caused the problem but it did not make any difference when I changed it. If I keep the spaces between the words "Items Changes Vendor Comments" they will print but as soon as I add a lot of spaces to place the words where I want them across the page i.e. "Items________________________Changes______________________________Vendor____________________Comments" I get the error again.<o:p></o:p>
Regards<o:p></o:p>
 
Last edited:
Upvote 0
the error is that you take it past the page margins try to play with the margins to see if that helps. or take a way from the space you add and see if you can get it.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,690
Members
449,117
Latest member
Aaagu

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