![]() |
Find() and Replace() in Excel 2007 not working.
Hi,
My program needs to find any white text in an Excel Worksheet andset it's color to black. This is done prior to a automated printout, in order to make sure the white text shows up in the print out. This has worked fine until just recently. The code I've been using is (VB6): Dim oSheet as Object oSheet.Application.FindFormat.Clear oSheet.Application.FindFormat.Font.ColorIndex = 2 oSheet.Application.ReplaceFormat.Clear oSheet.Application.ReplaceFormat.Font.ColorIndex = 1 oSheet.Cells.Replace What:="", Replacement:="", SearchFormat:=True, ReplaceFormat:=False In a simple example, make an Excel file with one cell that has black text, and one cell with white text. It should find the white text, and change it's color to black. I upgraded Office to 2007 from 2003. Under 2003 everything worked as expected. Under 2007, everything works fine with 2003 documents (xls), but NOT with 2007 documents (xlsx). The documents are identical, for all intents and purposes, and I am able to find the text using the same technique via the UI. I have inspected the cell and the cell has ColorIndex of 2, and should be found, ut it is not. Using Range.Find() or Range.Replace() with SearchFormat set to True, never finds this cell, even though it should. Can anyone explain why that is? Is there a difference in 2007 that effects searching by format? Thanks, Troy |
All times are GMT +1. The time now is 12:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com