I am trying to use AppleScript to sequentially open Microsoft Word documents in a folder to perform actions on them. However, I am getting an error related to access privileges whenever the script tries to open each file. Specifically, I get this:
I have searched these forums and google for how to circumvent this, but have not had success with any of the existing suggestions. I am hoping someone here can set me in the right direction.
Thank you.
macOS: 10.13.1
Microsoft Word 2016: 15.40
tell application "Finder"
set fl to files of folder POSIX file "/Users/username/Desktop/Test Data Summaries" as alias list
end tell
repeat with f in fl
set theFile to f as alias
tell application "Microsoft Word"
activate
delay 1
open theFile password document "password"
delay 5
close active document
end tell
end repeat