The Function I posted returns the Hexidecimal Value of Each Element of the Color (RGB), to Convert this to a Decimal Value use Val("&H" & HexValue), eg.
sWhite = Val("&H" & GetRGB(vbWhite, 0)) & " " & Val("&H" & GetRGB(vbWhite, 1)) & " " & Val("&H" & GetRGB(vbWhite, 2))
This would assign "255 255 255" to sWhite.
If all you're interested in is the Decimal Value, then Modify the Function to Convert the Hex Before Returning the Value, eg.
------------------Code:Private Function GetRGB(ByVal lColor As Long, Optional ByVal iPigment As Integer = 3) As String Dim sCol As String sCol = Right$("000000" & Hex$(lColor), 6) If iPigment > 2 Then GetRGB = Val("&H" & Right$(sCol, 2)) & " " & Val("&H" & Mid$(sCol, 3, 2)) & " " & Val("&H" & Left$(sCol, 2)) Else GetRGB = Val("&H" & Mid$(sCol, 5 - (iPigment * 2), 2)) End If End Function
Aaron Young
Analyst Programmer
[email protected]
[email protected]




Reply With Quote