Reading Excel Text Attributes from Access 97


Question

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

Answer

From: Shamil Salakhetdinov <shamil@marta.darts.spb.ru>
Subject: Re: Reading Excel Text Attributes from Access 97
Date: 15 February 1999 19:48

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


HOME    TOPICS

Copyright © 1998–1999 by Shamil Salakhetdinov.
All rights reserved. Terms of use.

Last updated: October 10, 2006

Published also here at 4TOPS: Reading Excel Text Attributes from Access 97