I am trying to convert different files (Word, Excel) in a folder to PDF files ("interim pdf files") and then merge them into one PDF file. In order to do this, I will select all Word documents, and Excel documents, and run through them in separate loops to convert to interim pdf files via PDF Printer.
Take the Word loop as an example:
To ensure the same UI window name, I will rename each Word document (currentitem) to ToPrint.docx, and then print ToPrint.docx to PDF Printer, and then populate the "save as" with the original document directory and name followed by ".pdf".
The issue I am encountering is: The loop will go through first run ok, but during the 2nd run, I receive an error message that I cannot rename the 2nd file because ToPrint.docx is used by another process.
I have also added a wait for 60 seconds just in case the previous process takes longer time. However, I still get the same error.