PDA

View Full Version : Solved: Please Help - Major Problem



Djblois
05-11-2007, 06:07 AM
I have found a lot of ways to reduce the size of my code. I am using this code to set the pagesetup:

PagSetPrintHeading "&A", "Atalanta", fnCalcTime(workingBook, 2)

Sub PagSetPrintHeading(ByRef sgCenterHeaderText As String, _
Optional ByRef sgLeftHeaderText As String, Optional ByRef sgRightHeaderText As String, _
Optional ByRef lgZoom As Long, Optional ByRef sgOrientation As String)
With ActiveSheet.PageSetup
On Error Resume Next
.LeftHeader = "&""Arial,Bold""&12" & sgLeftHeaderText
.CenterHeader = "&""Arial,Bold""&14" & sgCenterHeaderText
On Error Resume Next
.RightHeader = "&""Arial,Bold""&12" & sgRightHeaderText
On Error Resume Next
.Zoom = lgZoom
On Error Resume Next
.Orientation = sgOrientation
End With
End Sub


and finally the function:

Function fnCalcTime(shtLookup As Worksheet, lgColumn As Long)
With Application.WorksheetFunction
fnCalcTime = .text(.Min(shtLookup.Columns(lgColumn)), "mm\\dd\\yy") & " - " & .text(.Max(shtLookup.Columns(lgColumn)), _
"mm\\dd\\yy")
End With
End Function

I have no problem with errors. The problem is the right header doesn't print, instead it prints almost like it is a watermark, not a right header.

Bob Phillips
05-11-2007, 06:38 AM
It is being printed at 120 pitch



Function fnCalcTime(shtLookup As Worksheet, lgColumn As Long)
With Application.WorksheetFunction
fnCalcTime = " " & .Text(.Min(shtLookup.Columns(lgColumn)), "mm\\dd\\yy") & " - " & .Text(.Max(shtLookup.Columns(lgColumn)), _
"mm\\dd\\yy")
End With
End Function

Djblois
05-11-2007, 06:41 AM
ok, How do I fix the Pitch???

Bob Phillips
05-11-2007, 06:43 AM
I've already told you how to fix it.

Djblois
05-11-2007, 08:05 AM
sorry xld,

at first it looked exactly the same, I notice the difference. thank you let me test