问题描述
限时送ChatGPT账号..我目前正在编写工作中的 VBA 宏,但是我遇到了一个问题,希望您能帮助我.
I am currently in the process of writing a VBA macro at work however I have run into a problem which I am hoping you can help me with.
我想要做的只是从 excel 中运行一个 applescript 应用程序,这在 2011 版中很容易做到,但在 2016 版中似乎变得更加复杂.
All I am trying to do is simply run an applescript app from excel, this was very easy to do in the 2011 version but has seemingly gotten a lot more complicated in the 2016 edition.
我在网上研究了很多地方,但没有运气,我遇到的唯一文章和指南指向参数和检查文件,但不幸的是我不知道这些是什么.我想做的就是提供applescript的文件路径,以便excel可以运行它,这些还有可能吗?
I have researched various places online but with no luck, the only articles and guides I have come across point towards parameters and checking files but unfortunately I have no idea what any of those are. All I would like to do is to provide the filepath of the applescript so that excel can run it, is these even possible anymore?
我已经附上了相关的applescript文件,请不要过分评价我有多糟糕,我上周才开始学习.
I have attached the relevant applescript file, please don't judge me too hard for how bad it is, I only started learning last week.
在 Excel 2011 中工作的代码如下:
The code that worked in Excel 2011 was as follows:
OSA = "/usr/bin/osascript"
SCRIPT = "/users/savePDF.scpt"
MacScript ("do shell script " & Chr(34) & OSA & " " & SCRIPT & Chr(34))
但是,在 excel 2016 中,我尝试使用 AppleScript 任务命令,但出现编译错误,表明该参数不是可选的.虽然我不确定他们在谈论什么论点
However in excel 2016 I am trying to use the AppleScript task command but get a compile error that the argument is not optional. Although I am not sure what argument they are talking about
非常感谢您的帮助.
推荐答案
这似乎是个愚蠢的问题,现在我终于找到了答案.
Seems like such a stupid question now I've finally figured out the answer.
鉴于我没有控制任何变量或在 applescript 和 VBA 之间来回传递任何值,applescripttask 命令对我来说毫无用处.
Seeing as I didn't to control any variables or pass any values back and forth between applescript and VBA, the applescripttask command was pretty useless for me.
我最终能够通过简单地使用超链接命令来启动.app",如下所示:
I ended up being able to launch the ".app" by simple using the hyperlink command, as follows:
ActiveWorkbook.FollowHyperlink Address:="/Users/(usernamehere)/Desktop/savePDF1.app", NewWindow:=True
这篇关于如何简单地从 mac excel 2016 运行 applescript 任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论