Slow Macro
Print formatting is very slow. Try changing the default printer to "Microsoft
Office Document Image Writer" before running the macro. It should update the
header much faster. You could even retrieve the current default printer at
the beginning of your macro using Application.ActivePrinter, store it in a
string variable, change the active printer to "Microsoft Office Document
Image Writer", update the headings, then restore the original printer.
Hope this helps,
Hutch
"JRK" wrote:
One macro I use adds a name from a form into the header of 20-25 reports. The
procedure is called in Private Sub Worksheet_Change() as such:
'THIS LIMITS EXECUTION TO CHANGE IN SPECIFIC CELL
Dim mySheet As Worksheet
Set mySheet = Sheets("UserInfo")
Dim myName As Range
Set myName = mySheet.Range("F4")
If Not Intersect(Target, myName) Is Nothing Then
Call addHeader
End If
'THIS IS MACRO EXECUTED
Sub addHeader()
Dim Cell As Range
Dim myName, cName, myDate As String
myName = Sheets("UserInfo").Range("F4").value
cName = Sheets("UserInfo").Range("F24").value
myDate = Sheets("UserInfo").Range("F25").value
On Error Resume Next
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
With Worksheets("Acquisition")
.PageSetup.RightHeader = "&""Tahoma,Regular""&8Prepared by: " _
& myName & ", " & myDate
.PageSetup.LeftHeader = "&""Tahoma,Regular""&8Prepared for: " _
& cName
End With
'''TOTAL OF 25 WS
The procedure takes about 10 seconds. Any ideas how I can reduce the time it
takes? TIA
|