使用AppleScript在Excel 2016中打开文件

在Excel 2016中,以下AppleScript:

tell application "Microsoft Excel" activate open "Macintosh HD:Users:path:to:file" end tell 

打开一个对话框,要求用户授予访问权限 截图 在以前的Excel版本中,该文件立即打开。 看来,如果没有明确的用户权限,Microsoft不允许从脚本打开文件。
有没有办法绕过对话?

使用文件对象或别名对象而不是string

 tell application "Microsoft Excel" activate open file "Macintosh HD:Users:path:to:file" -- or --> open alias "Macintosh HD:Users:path:to:file" end tell 

当你有一个POSIXpath,你可以使用这个( open POSIX file "..."不起作用)

 tell application "Microsoft Excel" activate set my_file to POSIX file "/Users/name/path/to/file" open my_file end tell