Get The RGB Value Of A Color

'Insert the following code to your form:

Private Function Red&(ByVal Color&)
Red = Color And (Not &HFFFFFF00)
End Function

Private Function Green&(ByVal Color&)
Green = (Color And (Not &HFFFF00FF)) \ &H100&
End Function

Private Function Blue&(ByVal Color&)
Blue = (Color And (Not &HFF00FFFF)) \ &HFFFF&
End Function

Private Sub Form_Load()
'Change all the '&HFF&' below with the value of the color you want to get his RGB value.
MsgBox Red(&HFF&) & "," & Green(&HFF&) & "," & Blue(&HFF&)
End Sub

Go Back