Copy link to clipboard
Copied
While running the code: saveAs("C:\temp\temp.xlsx", "com.adobe.acrobat.xlsx") it will start converting before the error: "The specified file could not be written to. It may be in use" pops up and the conversion fails. So I decided to test that theory using the Windows utility File Locksmith, the only program accessing the PDF is Acrobat DC.
I also tested just converting through Export menu and it works just fine, this error only occurs when using JavaScript. How can I bypass this issue as I am looking to automate this process using VBA after confirming the javascript is working.
Copy link to clipboard
Copied
Found the solution.
Under Preferences -> Security (Enhanced) -> Disable Protected Mode at startup
After changing that setting and restarting the code was executing flawlessly.
Copy link to clipboard
Copied
The correct file-path syntax you need to use is this:
"/C/temp/temp.xlsx"
Copy link to clipboard
Copied
Thanks for the fast response,
On a Windows system you would use a more Unix like path?
Testing with the path set as "/C/temp/temp.xlsx" still produces the same error unfortunately.
Copy link to clipboard
Copied
It's the same path syntax for all platforms.
The code works fine for me. Do you actually have a folder called "temp" under the C drive? Because the script can't create it for you.
Copy link to clipboard
Copied
I do, I have also tested other paths to see if it was a permissions issue.
I tried on my secondary drive with the path "/E/temp.xlsx" and "/E/project/temp.xslx" Still the same error message. I have now also tested on other work machines and the same issue persists so it's not an installation issue.
Copy link to clipboard
Copied
Found the solution.
Under Preferences -> Security (Enhanced) -> Disable Protected Mode at startup
After changing that setting and restarting the code was executing flawlessly.