What is the correct syntax for save as active document in Word using Applescript?
applescript, ms-office, ms-word
Solution
It seems I found it after all:
set myDoc to "/Users/X/Desktop/test.docx"
set pdfSavePath to "Users:X:Desktop:test.pdf"
tell application "Microsoft Word"
activate
open myDoc
set theActiveDoc to the active document
save as theActiveDoc file format format PDF file name pdfSavePath
end tell
I am no AppleScript expert. I had slashes instead of : as path separators. With : it works
Problem
I am going nuts here. I have tried countless permutations/variations of "save as active document file format PDF" but none seem to work. I get AppleScript errors with all of them. So can anyone tell me: What is the exact syntax to save the active document as a PDF file in AppleScript, using Word? It seems that there is no coherence whatsoever in the Office for Mac scripting, as I have this working for Excel and PowerPoint and even there the syntax is different: excel ``` save active workbook in 'MyFile.pdf' as PDF file format ``` PowerPoint ``` save active presentation in 'MyFile.pdf' as save as PDF ``` What is the correct syntax for Word? Thanks!