我遇到的问题是我总是收到新的电子表格,如果我运行下面的代码。
set resultWorkBook to "/Users/x/Desktop/myfile.xmls"
tell application "Microsoft Excel"
set resultWorkbook to open workbook workbook file name posix_file without update links
end tell
它将尝试打开电子表格,然后提出询问是否授予访问权限的对话框窗口。
如果我像这样运行相同的电子表格。
tell application "Finder
set filecontents to file of folder Desktop of (path to home folder)
end tell
tell application "Microsoft Excel"
set display alerts to false
set resultWorkbook to open filecontents
end tell
它会在不要求访问权限的情况下打开工作簿,但后来要求我从电子表格中的链接中选择三个选项之一。
我真的需要两全其美,并想知道是否有人能给我一个解决方案。
由于
答案 0 :(得分:0)
只需将posix路径(字符串)转换为file
对象,就像这样
set posix_file to "/Users/x/Desktop/myfile.xmls" as POSIX file
tell application "Microsoft Excel"
set resultWorkBook to open workbook workbook file name posix_file without update links
end tell
更新;区别在于as POSIX file
命令。