My previous mail contain some VBA code and a HTML content.
First part of my mail explained how to generate that VBA code and HTML.
Now I will explain how you can use them to find equivalent html color
for a Excel colorIndex.
Method 1
1. Save the HTML content I send you to excel_color.html file.
2. open firefox
3. Install "Computed style" on your firefox toolbar from
https://www.squarefree.com/bookmarklets/webdevel.html
4. open excel_color.html in firefox
5. run "Computed style" bookmarklet by clicking it.
6. now you get a "cross" cursor.
7. click a cell you want know the RBG color code.
- say top left column
- which in excel is equvalent to A1
8. you see a new window opens and list CSS property
9. one of the CSS propery says "background-color: rgb(0, 0, 0)"
- now you got the RBG values
10. goto VBA code
11. then search for "A1"
12. you will reach following line
Range("A1").Select
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
End With
13. from that you can Identyfy the .ColorIndex = 1
Method 2.
1. Save the HTML content I send you to excel_color.html file.
2. open it in a note pad
3. Identify the HTML code which for a cell (say A1)
- In this case it is
<td height=17 class=xl223297 width=64
style='height:12.75pt;width:48pt'> </td>
4. Identify its class
in this case "xl223297"
5. search html file again for style definition of "xl223297"
- you see
.xl223297
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:windowtext;
font-size:10.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Arial;
mso-generic-font-family:auto;
mso-font-charset:0;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
background:black;
mso-pattern:auto none;
white-space:nowrap;}
6. Identify CSS attribute for "background"
- here it is "background:black;"
7. Now find RBG from table at
http://www.w3.org/TR/css3-color/#svg-color
8. Now goto VBA code
9. Search for "A1"
- you reach
Range("A1").Select
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
End With
10. below that you see ".ColorIndex = 1"
- that is equvalent Excel color code.
On Sat, Mar 14, 2009 at 6:58 AM, Zsolt Koppany <[email protected]> wrote:
> Hi Biju,
>
> sorry, I don't understand what you mean. Can you give me a hint?
>
> Zsolt
>
> Biju schrieb:
>>
>> I have generated Excel Macros while editing an excel sheet to add colors.
>> Then I save the sheet as HTML. You can compare VBA code and HTML to
>> find the conversion table.
>> For your convenience i am listing them done.
>>
>> To easily find color in html you can use "computed styles" bookmarklet
>> from
>> https://www.squarefree.com/bookmarklets/webdevel.html
>>
>>
>> PS: If I had some time I should done it in a better way.
>> ie use a VBA macro/POI code to produce excel sheet with color, for
>> colorIndex from 0 to max.
>> Then save the sheet as html. Then put a javascript code to find its RBG
>> value
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]