View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Chris Scott Chris Scott is offline
external usenet poster
 
Posts: 7
Default Issues with Slow Print to PDF Program...

This codes does the exact same thing. In the previous code, I am not sure which variable was named as a keyword.

Sub OILPDF()
Application.ScreenUpdating = False

'Unprotect sheet so that work can be done
Sheet3.Unprotect Password:="Tr2010"
Sheet11.Unprotect Password:="Tr2010"

Dim lrow As Integer
Dim Fname As String
Dim todaysDate As String

todaysDate = Format(Now(), "MM-DD-YYYY")

With Sheet11
lrow = .Cells(.Rows.Count, 1).End(xlUp).Row
.Range(.Cells(9, 1), .Cells(lrow, 17)).ClearContents
.Range(.Cells(9, 1), .Cells(lrow, 17)).ClearFormats
End With

With Sheet3
lrow = .Cells(Sheet3.Rows.Count, 2).End(xlUp).Row
.Range(.Cells(4, 1), .Cells(lrow, 17)).Copy _
Sheet11.Cells(4, 1)
End With

Fname = ActiveWorkbook.Path & "\" & Sheet1.Range("C6").Value & " Open Issues " & todaysDate & ".pdf"

Sheet11.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Fname, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=True, OpenAfterPublish:=False

'Protect sheet so that no work can be done
Sheet3.Protect Password:="Tr2010"
Sheet11.Protect Password:="Tr2010"

Application.ScreenUpdating = True


End Sub