Simple Excel Applescript

Am I new to Applescripts and Excel 08? I want to write one that sets randomly selected cells in Excel 08 special colors. I can get it to write the desired cell in the selected cell and even bold ... but for some reason it won't change the cell color ...

print("Tell application "Microsoft Excel"
activate
set formula of active cell to "excellent answer"
set bold of font object of active cell to true
activate cell active cell");

      

This part doesn't work for some reason

print("tell interior object of active cell of active sheet
    set color index to 3
    set pattern to pattern gray 50
    set pattern color index to 13
end tell");

      

not sure why

+1


source to share


1 answer


I was able to set the color of a specific cell in Excel 08 (and now 2011) using the following AppleScript:

tell sheet "Sheet1" of theWorkbook    
set color of interior object of range C2:C2 to {255, 255, 0}
end tell

      



I needed to specify a color in a specific range and use the values ​​of the Red, Blue and Green components (from 0 to 255).

+1


source







All Articles