Mic*_*ich 3 excel applescript applescript-excel excel-2016
在Excel 2016中,以下AppleScript:
tell application "Microsoft Excel"
activate
open "Macintosh HD:Users:path:to:file"
end tell
Run Code Online (Sandbox Code Playgroud)
打开一个对话框,要求用户授予访问权限
使用以前的Excel版本,文件立即打开.似乎微软不允许在没有明确用户许可的情况下从脚本中打开文件.
有没有办法绕过对话框?
使用文件对象或别名对象而不是字符串
tell application "Microsoft Excel"
activate
open file "Macintosh HD:Users:path:to:file"
-- or --> open alias "Macintosh HD:Users:path:to:file"
end tell
Run Code Online (Sandbox Code Playgroud)
当你有POSIX路径时,你可以使用它(open POSIX file "..."不起作用)
tell application "Microsoft Excel"
activate
set my_file to POSIX file "/Users/name/path/to/file"
open my_file
end tell
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3469 次 |
| 最近记录: |