D
Dave Peterson
I recorded a macro when I change the center header to "asdf" and used a font
size of 72.
This was the important part of that recorded macro:
With ActiveSheet.PageSetup
.CenterHeader = "&72asdf"
End With
So my code changed to:
Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Cell As Range
Dim HeaderStr As String
Dim mySheetNames As Variant
Dim iCtr As Long
mySheetNames = Array("IS-LA", "BS-LA", "BS-LA-CV")
For iCtr = LBound(mySheetNames) To UBound(mySheetNames)
HeaderStr = "&72" '<--start with that font size string.
With Worksheets(mySheetNames(iCtr))
'do your stuff
For Each Cell In .Range("a1:a4")
HeaderStr = HeaderStr & Cell.Value & vbCr
Next Cell
'Remove last vbCr
HeaderStr = Left(HeaderStr, Len(HeaderStr) - 1)
.PageSetup.CenterHeader = HeaderStr
End With
Next iCtr
End Sub
72 point seems a little large to me, though.
size of 72.
This was the important part of that recorded macro:
With ActiveSheet.PageSetup
.CenterHeader = "&72asdf"
End With
So my code changed to:
Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Cell As Range
Dim HeaderStr As String
Dim mySheetNames As Variant
Dim iCtr As Long
mySheetNames = Array("IS-LA", "BS-LA", "BS-LA-CV")
For iCtr = LBound(mySheetNames) To UBound(mySheetNames)
HeaderStr = "&72" '<--start with that font size string.
With Worksheets(mySheetNames(iCtr))
'do your stuff
For Each Cell In .Range("a1:a4")
HeaderStr = HeaderStr & Cell.Value & vbCr
Next Cell
'Remove last vbCr
HeaderStr = Left(HeaderStr, Len(HeaderStr) - 1)
.PageSetup.CenterHeader = HeaderStr
End With
Next iCtr
End Sub
72 point seems a little large to me, though.
HeaderStr = "72Left(HeaderStr, Len(HeaderStr) - 1)"
Regarding the font size (e.g., size of 72), I tried this and about 20 other
variations (all to no avail), but since I did it (recorded a macro that
enlarged the font size) on text that was already within the text box, it's
not the same as doing this to a variable, I fear. Kindly help.
Thx!
Dean