LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Using VBA to set Headers and Footers with Font and Fontsize parameters

I'm using the following code to automatically add headers and footers for
all the sheets in my workbooks.

Although it works, it is extraordinarily slow -- 2-3 minutes.

Can anyone suggest a way to do this faster. I am using Office XP, under
Windows 2000 Pro operating system.

The code I am using is:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim sCount, i As Integer
sCount = Worksheets.Count
For i = 1 To sCount
With Worksheets(i).PageSetup
.LeftHeader = "&""Arial""&8" & "Worksheet: &A"
.LeftFooter = "&""Arial""&8" & ThisWorkbook.FullName & Chr(10) &
" " & Chr(10) & " "
.CenterFooter = "&""Arial""&8" & "Page &P of &N"
.RightFooter = "&""Arial""&8" & "Print Date: &D"
End With
Next i
End Sub


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change colour of font in xls headers/footers masonrj1 Excel Discussion (Misc queries) 1 October 24th 09 04:09 PM
Excel-Default Font for Headers and Footers marcopolo Excel Discussion (Misc queries) 0 May 30th 08 02:39 AM
How do I set the default font for headers and footers in Excel? KC Excel Worksheet Functions 1 March 17th 06 07:19 PM
Font Colors with headers and Footers sip8316 Excel Discussion (Misc queries) 1 June 18th 05 12:40 AM
Headers/Footers Default Font? Ken Excel Discussion (Misc queries) 0 March 10th 05 09:01 PM


All times are GMT +1. The time now is 06:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"