在Excel 2016打开文件使用AppleScript [英] Open file in Excel 2016 using AppleScript

查看:1025
本文介绍了在Excel 2016打开文件使用AppleScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Excel 2016年,以下AppleScript的:

In Excel 2016, the following AppleScript:

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

打开一个对话框,要求用户授予访问
随着previous Excel的版本中,文件立即打开。
看来,微软不允许任何更多可以直接打开脚本文件而不除权preSS用户权限。结果
有没有办法绕过对话?

opens a dialog asking the user to grant access With previous Excel's versions, the file opened immediately. It seems that Microsoft doesn't allow any more to open a file from a script without the express user permission.
Is there a way to bypass the dialog?

推荐答案

使用的文件对象或别名对象,而不是字符串

Use a file object or an alias object instead of a 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

这篇关于在Excel 2016打开文件使用AppleScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆