Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
formulas and colorindex don't work after opentext
I am opening a text file with OpenText but when I do, and then try setting
the background color, the row color doesn't change. Yet when I set the color from a different sub, executed AFTER the initial sub, the color is set. Anyone experience weirdness like this before? This is the opentext line: Workbooks.OpenText Filename:=varFileName, DataType:=xlFixedWidth, fieldinfo:=Array(Array(0, 1), Array(9, 2), Array(21, 3), Array(32, 1), Array(40, 1), Array(48, 1), Array(54, 1), Array(65, 1), Array(74, 1), Array(83, 1), Array(89, 1), Array(100, 1)) and the formula and color settings: Cells(r, 1).EntireRow.Interior.ColorIndex = 5 yet these subs work - after the initial sub is finished - but not when called from within the initial sub. Sub a() setrowcolor 5, 3 End Sub Sub setrowcolor(rownum, rowcolor) Cells(rownum, 1).EntireRow.Interior.ColorIndex = rowcolor End Sub Thanks, Keith |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
formulas and colorindex don't work after opentext
Please forgive my error. I found a logic error which prevented the code in
that area from being executed. Sorry. "Keith" wrote in message ... I am opening a text file with OpenText but when I do, and then try setting the background color, the row color doesn't change. Yet when I set the color from a different sub, executed AFTER the initial sub, the color is set. Anyone experience weirdness like this before? This is the opentext line: Workbooks.OpenText Filename:=varFileName, DataType:=xlFixedWidth, fieldinfo:=Array(Array(0, 1), Array(9, 2), Array(21, 3), Array(32, 1), Array(40, 1), Array(48, 1), Array(54, 1), Array(65, 1), Array(74, 1), Array(83, 1), Array(89, 1), Array(100, 1)) and the formula and color settings: Cells(r, 1).EntireRow.Interior.ColorIndex = 5 yet these subs work - after the initial sub is finished - but not when called from within the initial sub. Sub a() setrowcolor 5, 3 End Sub Sub setrowcolor(rownum, rowcolor) Cells(rownum, 1).EntireRow.Interior.ColorIndex = rowcolor End Sub Thanks, Keith |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
DataLabel.Font.ColorIndex vs DataLabel.Text (Private Sub does not work in excel 2003) | Charts and Charting in Excel | |||
Workbooks.OpenText does not work on XP. HELP !!! | Excel Programming | |||
Cell.interior.colorindex - does not work in Excel 97 | Excel Programming | |||
After OpenText all pastes from external apps use format from OpenText | Excel Programming | |||
OpenText bug ? | Excel Programming |