On 6/2/2009 12:35 PM, Ralf Kefferpuetz wrote:
is it possible to write a script to announce the background color of an
Excel cell automatically?

Anything is possible with Window-Eyes scripting. <grin>

You can retrieve and set a cell's foreground and background colors using the Font and Interior properties respectively. The following example creates a new worksheet, adds a value to cell A1, and sets the foreground color to red, and background color to green.

Set e = GetObject("", "Excel.Application")
e.WorkBooks.Add
e.Cells(1,1).Value = "This is a test"
e.Cells(1,1).Font.ColorIndex = 3
e.Cells(1,1).Interior.ColorIndex = 4

So you'd want to write script that would get the active cell and speak the ColorIndex property of the cell's Interior property. The only issue with this is that you'll only get back a number indicating a color, rather than a human readable string.

So you'll want to create an array of colors, indexed appropriately to match the ColorIndex value. That sound daunting, but I believe that Excel restricts the number of colors it supports to something like 56, so it's not terribly awful.

That should at least get you started.

Aaron

--
To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.

Aaron Smith
GW Micro
Phone: 260/489-3671
Fax: 260/489-2608
WWW: http://www.gwmicro.com
FTP: ftp://ftp.gwmicro.com
Technical Support & Web Development

Reply via email to