如何获得excel插入一个新的图像与苹果?
我有以下的Applescript:
tell application "Microsoft Excel" tell active workbook make new picture at end with properties {save with document:true, file name:"/Users/yuval/Pictures/foobar.jpg"} end tell end tell
根据几个来源,这应该工作。
但是,每次运行脚本时,都会收到消息
Microsoft Excel出现错误:无法创build类图片。
在描述中,我看到了错误
错误“Microsoft Excel出现错误:无法创build类图片”。 数字-2710从图片到类
经过两个小时的search,我完全不知道该怎么做。 任何帮助将不胜感激!
详细信息: 在Mac OS X 10.7 Lion上运行Microsoft Excel 2011
有两件事情,尽pipe这里的警告是我在Excel 2008中工作,但是没有大声疾呼,Applescript的实现不会有太大的改变:
首先,确保你使用正确的文件path格式。 AppleScript历史上与HFSpath,而不是POSIX
set theFilePath to "Macintosh HD:Users:UserName:Path:To:File.pic" --choose file
其次,确保你正在采取适当的行动。 因为active workbook
不是“词典”中的一个属性,所以我可以使用active sheet
工作active sheet
进行这项工作:
tell application "Microsoft Excel" tell active sheet make new picture at end with properties {file name:theFilePath} end tell end tell
上面的代码结合起来为我工作。