AppleScript:设置Microsoft Excel单元格的背景颜色

使用AppleScript,我如何将“A3到E3的单元格”的背景颜色更改为浅灰色?

我仍然希望字体是黑色的。

这个答案的两个注意事项:您没有指定哪个版本的Excel,并且在v2004中testing了以下内容。

tell application "Microsoft Excel" set theRange to range "A3:E3" set interiorObject to interior object of theRange set color index of interiorObject to 5 -- '5' is only a dummy value; change as needed. end tell 

根据字典, color index是“颜色被指定为当前调色板中的索引值”。 换句话说,在你的安装中,浅灰色的颜色索引在其他地方可能是不同的。