با کد زیر می تونید رنگهای RGB را به Hex تبدیل کنید و Hex را به رنگ.
(( رنگ های موجود در یاهو به صورت HEX هست ))
Public Function rgbtohex(r As Byte, g As Byte, b As Byte)
'input format = 255,255,255
'get the r value
If r < 16 Then
hex1 = 0 & Hex(r)
Else
hex1 = Hex(r)
End If
'get the g value
If r < 16 Then
hex2 = 0 & Hex(g)
Else
hex2 = Hex(g)
End If
'get the b value
If b < 16 Then
hex3 = 0 & Hex(b)
Else
hex3 = Hex(b)
End If
rgbtohex = "#" & hex1 & hex2 & hex3
End Function
Public Function RGBtoColor(r As Byte, g As Byte, b As Byte)
RGBtoColor = r + (g * 256) + (b * 65536)
End Function
Public Function colortorgb(color As Long)
Dim r, g, b As Byte
r = color And 255
g = (color \ 256) And 255
b = (color \ 65536) And 255
colortorgb = r & "," & g & "," & b
End Function