From: Robert Aungst on 20 Oct 2009 17:15 Here's the basic code that would be required. h = actxserver('Excel.Application') h.Visible = 1 b = h.Workbooks.Add w = b.Worksheets.Add; get(w.Range('A1').Interior); This example is somewhat boring because you're creating the worksheet from scratch, so you know that the color is already, but what you're looking for is the Interior property. It'll look something like this when you get there: Interface.Microsoft_Excel_11.0_Object_Library._Workbook Application: [1x1 Interface.Microsoft_Excel_11.0_Object_Library._Application] Creator: 'xlCreatorCode' Parent: [1x1 Interface.Microsoft_Excel_11.0_Object_Library.Range] Color: 16777215 ColorIndex: -4142 InvertIfNegative: [1x241 char] Pattern: -4142 PatternColor: 0 PatternColorIndex: -4142 You'll have to look up what that Color field actually means. You can loop over what range you're interested and get the color of each cell. Cheers, Robert "Ben Taylor" <bentaylorche(a)gmail.com> wrote in message <hbdd6f$snb$1(a)fred.mathworks.com>... > Have you had any luck setting this up? Being able to read Excel cell background colors into Matlab? I have a large Excel file that I am stuck with and need to import and based on the background color in the cells I have to do different actions? Thanks.
|
Pages: 1 Prev: Printing problems with Snow Leopard Next: actxGetRunningServer with multiple Excels |