开发者

AppleScript: set Microsoft Excel cell's background color

Using AppleScript, how can I change the background color of "cells开发者_开发问答 ranging from A3 to E3" to light grey?

I still want the font to be in black.


Two caveats with this answer: You didn't specify which version of Excel, and the following was tested in 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

Per the dictionary, color index is "the color is specified as an index value into the current color palette". In other words, the color index that is light gray in your install maybe different elsewhere.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜