AnsweredAssumed Answered

Macro hangs if file is open

Question asked by James Barnes on Mar 7, 2018
Latest reply on Mar 8, 2018 by James Barnes

the line that hangs the macro:

boolstatus = swModelDocExt.SaveAs(filename, 0, 0, swExportData, lErrors, lWarnings)


this macro saves the current drawing as a PDF file. It works just fine unless the PDF is open in Adobe reader.

not usually a problem before as I was the only person that had access to the PDF file system, but... always one.

now we a few users that can access the PDF files though a custom app.

so sometimes a PDF will be open that I'm trying to save, on another machine hanging the macro.

I've tried On Error GoTo..  but it doesn't see it as an error.


for testing I've opened the PDF on my local machine, the macro will hang. at least until I close the PDF file then the macro will complete.


is there a timeout setting in the API I can set or some other way to detect the PDF is open before trying to save?