AppleScript从Excel工作表中获取活动单元格的值

尝试从Excel工作表中获取当前突出显示的单元格的值

set x to null tell application "Microsoft Excel" tell worksheet "Sheet1" of active workbook set x to value of active cell as string display dialog x end tell end tell 

以上AppleScript将x设置为“缺失值”。 我在这里做错了什么,有没有其他的方式来获得活动单元格的价值?

我正在使用MAC版本14.0.0的Microsoft Excel 2011

如果你看看excel的applescript字典,你会看到“active cell”是应用程序的一个属性。 这不是工作表或工作簿的属性。 所以这个作品…

 tell application "Microsoft Excel" set x to value of active cell as string display dialog x end tell 

这也是一个窗口的属性,所以这也适用…

 tell application "Microsoft Excel" tell window 1 set x to value of active cell as string display dialog x end tell end tell