Theres a lot of code out there for getting the windows colour picker dialog, but it can be hard to get a RGB code out of this. For example, if you want to set the colour of a form text box, then get it's RGB value to colour a worksheet cell. (That's what i used it for anyway!)
Heres one method:
Private Declare Function GetSysColor Lib "user32" _
(ByVal nIndex As Long) As Long
<blockquote>Function GetRGBColors(ByVal oColor As OLE_COLOR)
If oColor And &H80000000 Then
oColor = GetSysColor(oColor And &HFF&)
End If
GetRGBColors = Array( _
(oColor And &HFF&), _
(oColor And &HFF00&) \ &H100, _
(oColor And &HFF0000) \ &H10000)
End Function
(ByVal nIndex As Long) As Long
<blockquote>Function GetRGBColors(ByVal oColor As OLE_COLOR)
If oColor And &H80000000 Then
oColor = GetSysColor(oColor And &HFF&)
End If
GetRGBColors = Array( _
(oColor And &HFF&), _
(oColor And &HFF00&) \ &H100, _
(oColor And &HFF0000) \ &H10000)
End Function
Sub RGB()
Dim vRGB() As Variant
vRGB = (GetRGBColors(ActiveCell.Interior.Color))
MsgBox "Red " & vRGB(0) & ", Green " _
& vRGB(1) & ", Blue " & vRGB(2)
End Sub