-
change Excel Cell Forecolor using VB6
Hi All
Greetings. The version that I have writtin using LISTVIEW is working very well. I have another interesting problem which is beyong my knowledge. I have been asked to display in the Excel Cell forecolor in RED and not the backcolor if the exported data from ACCESS Sales Table whose sales value did not meet certain value.
this script is not working:
objWorksheet.Cells(intRow, intCol).Fill.Schemecolor = vbRed
Here is part of the overall VB6 script that I have written
Do Until .EOF
intCol = 0
intRow = intRow + 1
For i = 0 To (.Fields.Count - 1) Step 1
intCol = intCol + 1
objWorksheet.Cells(intRow, intCol) = .Fields(i).Value
If .Fields("SalesAmt").Value < 500 Then
objWorksheet.Cells(intRow, intCol).Fill.Schemecolor = VbRed
End If
.MoveNext
Loop
Cheers,
Lennie
-
Excel's macro recorder is your friend. Begin recording a macro, then manually perform the action(s) you wish to automate -- in this case, changing the forecolor of a cell -- then look at the code that was recorded. Try this:
objWorksheet.Cells(intRow, intCol).Font.Color = vbRed
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
Similar Threads
-
Replies: 7
Last Post: 02-22-2008, 09:42 AM
-
By Nick313 in forum VB Classic
Replies: 2
Last Post: 11-15-2007, 03:16 PM
-
By Ifgash in forum VB Classic
Replies: 1
Last Post: 04-23-2006, 02:58 AM
-
Replies: 2
Last Post: 01-08-2002, 03:54 AM
-
By Phil in Austin in forum .NET
Replies: 15
Last Post: 02-08-2001, 12:21 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|