I tried the above and couldn't get it to work.
I'm using a with statement and doing the following:
I can get EITHER the parameter to appear correctly, or the formatting to work, but then the parameter appears as the parameter name, not the named range.
Using two .CenterHeader lines didn't work, one overwrites the other:
using the suggestion in thread707-935461 gives me an error that "Method Range of object _Global failed"
What am I missing? There must be some way to make formatted variable in a header work (VBA and Excel 2002)
Thanks!
Lynette
I'm using a with statement and doing the following:
Code:
Windows("datafilemacros.xls").Activate
Dim vbySubtestTitle As String, vFooterPreparedby As String
vbySubtestTitle = Worksheets("constants").Range("BySubtestTitle")
vFooterPreparedby = Range("FooterPreparedby")
Windows("bySubtestData.xls").Activate
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = vbySubtestTitle
.RightHeader = ""
.LeftFooter = vFooterPreparedby
.CenterFooter = "&D, &T"
.RightFooter = "Page &P of &N"
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
I can get EITHER the parameter to appear correctly, or the formatting to work, but then the parameter appears as the parameter name, not the named range.
Using two .CenterHeader lines didn't work, one overwrites the other:
Code:
.CenterHeader = vbySubtestTitle
.CenterHeader = "&""ARIAL,BOLD""&12"
using the suggestion in thread707-935461 gives me an error that "Method Range of object _Global failed"
Code:
.CenterHeader = "&14 &B &ARIAL" & Range("bySubtestTitle")
What am I missing? There must be some way to make formatted variable in a header work (VBA and Excel 2002)
Thanks!
Lynette