Saves pdf And it keeps on going for days.

Hello,

The code below sometimes fails to finish and stays on swModelDocExt.SaveAs for days and I need to close the solidworks process and restart the macro. (longest wait was 36 hours)

This happens at random. Solidworks is open and all needed files are in my tmpPath, no errors or warnings are pressent

swModel = swApp.OpenDoc6(tmpPath & "\" & Document.Name, swDocumentTypes_e.swDocDRAWING, swOpenDocOptions_e.swOpenDocOptions_Silent, "", Errors, Warnings)

' Create New PDF
If Not swModel Is Nothing Then
     swModelDocExt = swModel.Extension
     swExportpdfData = swApp.GetExportFileData(swExportDataFileType_e.swExportPdfData)
     swModelDocExt.SaveAs(Output_Path & "\" & Output_Filename & ".pdf", swSaveAsVersion_e.swSaveAsCurrentVersion, swSaveAsOptions_e.swSaveAsOptions_Silent, swExportpdfData, Errors, Warnings)
End If

I don't know why it stays thier, normaly the saveas takes between 2 sec en 3 min depending on the size of het drawing.

If someone know the answer or to create a 5 min timeout before going to the next line so the code contineuos and I cane log the faild creation of the pdf file.

Thanks for any imput

SolidworksApi macros