I tried to convert docx to pdf and renamed the file by getting some letters from the original file name.
In Automator, I used "Get Specified Finder Items" and "Run AppleScript".
I executed and got a pop-up message in the Microsoft Word
"Can't export file. Something went wrong, and your file can't be exported now. Please try again later."
Anyone has any ideas what's wrong? Please help me out. Thanks.
- Microsoft Word : 16.35 (20030802)
- Automator : 2.10 (492)
- macOS : 10.15.4
on run {input, parameters}
repeat with aFile in input
tell application "Microsoft Word"
launch
try
open aFile
tell document 1
set fileName to aFile as text
set newName to "p" & (text 14 thru 15 of fileName) & "-" & (text 11 thru 12 of fileName) & "-" & (text 8 thru 9 of fileName)
set pdfOutput to (newName & ".pdf")
save as file name pdfOutput file format format PDF
end tell
close document 1 saving yes
on error
try
close document 1 saving no
end try
end try
end tell
end repeat
return input
end run