View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] christopherwscott76@gmail.com is offline
external usenet poster
 
Posts: 1
Default Issues with Slow Print to PDF Program...

I am having an issue where it takes almost a full minute for this code to finish creating a PDF. A publishing window comes up and it gets stuck after about 90% being complete. Then it waits there for what seems like a minute before it finishes. Not sure how to view in the code where it is stopping, but the code is pretty straight forward and I have used it on many other documents before. Here is what it looks like:

Sub OILPDF()
Dim lastOILrow As Integer
Dim message As Integer
Dim Filename As Variant
Dim lastPrintrow As Integer
Dim viewdate As String

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

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

Sheet3.Activate
lastOILrow = Sheet3.Cells(Sheet3.Rows.Count, 2).End(xlUp).Row
Sheet3.Range(Cells(4, 1), Cells(lastOILrow, 17)).Copy

Sheet11.Activate
Sheet11.Cells(4, 1).PasteSpecial

Filename = ActiveWorkbook.Path & Application.PathSeparator & Sheet11.Range("b6").Value & " Open Issues " & viewdate & ".pdf"
Sheet11.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Filename, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=True, OpenAfterPublish:=False

Sheet3.Activate

End Sub