ExportAsFixedFormat takes very long time

Viewed 63

I want to save many pdfs but the process of saving via ExportAsFixedFomat takes very long

Do you guys have some idea how to improve my Code (other functions,...)

Code

WordDoc.ExportAsFixedFormat OutputFileName:=wholeString, ExportFormat:=wdExportFormatPDF
2 Answers

Tough to figure out the exact reason in your case. But you can try to deactivate the screen updating like so:

..
Application.ScreenUpdating = False 

WordDoc.ExportAsFixedFormat OutputFileName:=wholeString, ExportFormat:=wdExportFormatPDF

Application.ScreenUpdating = True
..

Excel recalculates the workbook before each PDF is generated. Why this should be the case is not immediately obvious. The solution was to insert the following line of code at the beginning of the routine and turn it back to automatic at the end:

Application.Calculation = xlManual

This reduces the total time.

Related