AppleScript:设置Microsoft Excel单元格';背景色

AppleScript:设置Microsoft Excel单元格';背景色,excel,macos,applescript,Excel,Macos,Applescript,使用AppleScript,如何将“单元格范围从A3到E3”的背景色更改为浅灰色 我仍然希望字体为黑色。这个答案有两个警告:您没有指定Excel的哪个版本,以下内容在v2004中进行了测试 tell application "Microsoft Excel" set theRange to range "A3:E3" set interiorObject to interior object of theRange set color index of interiorO

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


我仍然希望字体为黑色。

这个答案有两个警告:您没有指定Excel的哪个版本,以下内容在v2004中进行了测试

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
根据字典,
颜色索引
是“将颜色指定为当前调色板中的索引值”。换句话说,安装中浅灰色的颜色索引在其他地方可能不同