Reading Excel Text Attributes from Access 97


Question

Is it possible to determine the color of Excel text from within Access 97 ?

Answer


Todd,

You could, probably, use ColorIndex property to do that:

Dim xapp As New Excel.Application
'  the next code line being too long could be wrapped by mail
'  systems - use start ('/)  and end ('\) line markers to recreate it:
'/
MsgBox xapp.Workbooks.Open(FileName:="C:\temp\Book1.xls").Worksheets("Sheet1").Cells(2, 2).Font.ColorIndex
'\
xapp.Quit
Set xapp = Nothing

or course you can rewrite sample code above this way:

Dim xapp As New Excel.Application
Dim xwbk As Excel.Workbook
Dim xrng As Excel.Range

Set xwbk = xapp.Workbooks.Open(FileName:="C:\temp\Book1.xls")
Set xrng = xwbk.Worksheets("Sheet1").Cells(2, 2)

MsgBox xrng.Font.ColorIndex

xwbk.Close
Set xwbk = Nothing

xapp.Quit
Set xapp = Nothing

HTH,
Shamil


Copyright 1999-2008 by Shamil Salakhetdinov.  All rights reserved.