How to set the backcolor of MS Excel cells
-
I'am trying to use VC to operate Ms Excel, but I can't set the back color of cells, what can I do for it?
freeman
-
I'am trying to use VC to operate Ms Excel, but I can't set the back color of cells, what can I do for it?
freeman
Here's a code segment written in VB
With Selection.Interior .ColorIndex = 3 ' this is red ... .Pattern = xlSolid End With
I think it it easy to know how to do it in VC from that. By the way, there is a way to know how to get some work accomplished in your codes: just open Excel, and record a macro doing just the same thing, then you can check the code in Excel's Macro editor. I got that piece of code in this way.
-
Here's a code segment written in VB
With Selection.Interior .ColorIndex = 3 ' this is red ... .Pattern = xlSolid End With
I think it it easy to know how to do it in VC from that. By the way, there is a way to know how to get some work accomplished in your codes: just open Excel, and record a macro doing just the same thing, then you can check the code in Excel's Macro editor. I got that piece of code in this way.
Good idear! I have solved my problem! Thank u! And do it in VC just need to add some codes follow: Interior bkColor; bkColor.AttachDispatch(range.GetInterior().pdispVal) bkColor.SetColor(COleVariant((long)0x000000)); //black Also Give Thank to a friend named ◎Alpha◎ who helped me, God will bless him and his family!:)
freeman