>>>OLE experts,
>>>Is there simple way to get RGB values out of color index value in
>>>excel?
>>>
>>>TIA
>>
>>nColor = oExcel.ActiveWorkbook.Colors(nColorIndex)
>>
>>Cetin
>
>Did not hv time to implement it yet
>but it will probably work as usual :)
>Thks++
Here is a quick check code:)
Create Cursor xlColors (colorIndex i, rgbval c(15),ncolor i)
oExcel = Createobject("Excel.Application")
With oExcel
.Workbooks.Add
For ix = 1 To 56
Insert Into xlColors ;
(colorIndex, rgbval, ncolor) ;
VALUES ;
( m.ix, ;
rgbstring( .ActiveWorkbook.ColorS(m.ix) ),;
.ActiveWorkbook.ColorS(m.ix))
Endfor
.Quit
Endwith
Locate
Public oForm
oForm = Createobject('Form')
oForm.AddObject('myGrid','grid')
oForm.myGrid.Columns(3).DynamicBackColor = "xlColors.ncolor"
oForm.myGrid.Columns(3).DynamicForeColor = "xlColors.ncolor"
oForm.myGrid.Visible = .T.
oForm.Show
Function rgbstring
Lparameters tnColor
Local lnRed,lnGreen,lnBlue
lnRed = Bitrshift(Bitand(m.tnColor, 0x0000FF),0)
lnGreen = Bitrshift(Bitand(m.tnColor, 0x00FF00),8)
lnBlue = Bitrshift(Bitand(m.tnColor, 0xFF0000),16)
Return Trans(m.lnRed)+","+Trans(m.lnGreen)+","+Trans(m.lnBlue)
PS: Colors is readwrite. You can change default palette IOW.
Cetin