gpt4 book ai didi

excel - Applescript 不会打开 Excel 2011 工作簿

转载 作者:行者123 更新时间:2023-12-04 22:10:04 25 4
gpt4 key购买 nike

有人可以告诉我以下applescript有什么问题吗

set sourceFile to (choose file with prompt "Choose source files" of type {"XLS6", "XLS7", "XLS8", "XLS", "TXT"} with multiple selections allowed without invisibles)
tell application "Microsoft Excel"
-- activate
open workbook workbook file name sourceFile
end tell

我收到以下错误
error "Microsoft Excel got an error: Can’t continue open workbook." number -1708

如果我对单个文件路径进行硬编码,则该脚本可以工作,因此问题必须在 set sourceFile 行中,但我需要能够选择一个文件,因为它并不总是相同的。

最佳答案

尝试这个:

set sourceFile to (choose file with prompt "Choose source files" of type {"XLS6", "XLS7", "XLS8", "XLS", "TXT"} with multiple selections allowed without invisibles) as string
tell application "Microsoft Excel"
open sourceFile
end tell

关于excel - Applescript 不会打开 Excel 2011 工作簿,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9516171/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com