Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting left footer that includes carrage returns

Status
Not open for further replies.

cboz

Technical User
Dec 24, 2002
42
US
I am trying to put a list in the page footer using & chr(10)&. Here is my code. What am I doing wrong?
With ActiveSheet.PageSetup

.LeftHeader = ""
.CenterHeader = "&""Arial,Bold""&14PO Price Variance"
.RightHeader = "&D"
.CenterFooter = ""
.RightFooter = "Page &P of &N"
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.5)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.25)
.FooterMargin = Application.InchesToPoints(0.75)
.LeftFooter = "Reason Code:1 Negotiated cost-down 2 Supplier cost incrrease 3 Volume change 4 New source" & Chr(10) & _
"5 Secondary source 6 Design/engineering change" & Chr(10) & _
"7 Inaccurate standard cost 8 Surcharge 9 Unplanned outsource" & Chr(10) & _
"10 Product transfer 11 Obsolete standard cost"
.PrintHeadings = True
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = True
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 72

End With

 
Have you tried to replace Chr(10) by vbCrLf or vbCr ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
try either change chr(10) to chr(13) or adding chr(13) to chr(10)

i.e.

chr(10) & chr(13)
 
I tried chr13 by itself and it work for the first two carrage returns but not for the third. Same problem I had with chr10. Is there a limit to the number of carrage returns you can have in a footer? I know I can have more than 3 lines in the footer by entering it manually. So why can't I do it with the macro? It is making me crazy.

I couldn't get the vbcrlf or vbcr to work but I may not have been using the correct syntax. & vbcrlf &
 
Have you tried the Excel macro recorder ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Thanks PH. Recording a macro was the first thing I tried. This really has me stumped.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top