AppleScript: set Microsoft Excel cell's background color

此生再无相见时 提交于 2019-12-11 01:56:31

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/2616872/applescript-set-microsoft-excel-cells-background-color

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!