Archive of Mr Excel Message Board

Back to Printing in Excel archive index
Back to archive home

Print Sheet Title Formatting
Posted by Sandro on January 25, 2002 5:17 AM
I'm trying to use VBA coding to format the title on a sheet before it prints. I know how to code it if the title is always the same. I also know how to insert the variable title ( see below ). Now I'm stuck because I can't format it.
sheetname3 = Range("e1")
ActiveSheet.PageSetup.CenterHeader = sheetname3
End Sub
Therfore, this will insert the contents of cell E1 into the top of the printed sheet, but the formatting will be default settings.

Re: Print Sheet Title Formatting
Posted by Ivan F Moala on January 25, 2002 7:51 AM
Followng example may help;
Note: Name of Font, &8 = size AND apostrophes!
With ActiveSheet.PageSetup
'## headers here ##
.CenterHeader = "&""Arial Black,Bold""&8 " & sheetname3
'## footers here ##
.CenterFooter = "&""Arial Black,Bold""&8 " & sheetname3
End With
Ivan

This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our
online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.