It appears there’s a severe AppleScript bug in Microsoft Word on Monterey. A user reported this and I can reproduce the bug on my machines. I wonder if someone who uses Word can confirm it?
The crash happens when passing any print settings properties when using the print command. Which makes the command pretty much useless.
Examples:
Word CRASHES with “Connection is invalid” error. The same will happen when using any number of properties:
tell application "Microsoft Word" to print document 1 with properties {copies:1}
Works (which is of no help as without the properties the script is useless):
tell application "Microsoft Word" to print document 1 with properties {}
tell application "Microsoft Word" to print document 1
I didn’t check on Big Sur indeed I just know that the script worked there when it was the current system.
In general, from my experience of the last fourteen years, scripting Office apps is constant struggle. New bugs pop up all the time for which new workarounds must be found, then old bugs get fixed but new ones appear, then old workarounds stop working and so on.
This bug seems to be the first one for which I can’t find any solution whatsoever.