Private Type zRGB
R As Long G As Long B As Long End Type Private Sub Form_Load() 'this is just an example 'if you don't tweak the code, you will have to 'dim a variable as "zRGB" that stores the returns Dim cRGB As zRGB cRGB = LongToRGB(RGB(255, 250, 255)) MsgBox cRGB.R & ", " & cRGB.G & ", " & cRGB.B End End Sub Private Function LongToRGB(ColorValue As Long) As zRGB Dim rCol As Long, gCol As Long, bCol As Long rCol = ColorValue And &H10000FF 'this uses binary comparason gCol = (ColorValue And &H100FF00) / (2 ^ 8) bCol = (ColorValue And &H1FF0000) / (2 ^ 16) LongToRGB.R = rCol LongToRGB.G = gCol LongToRGB.B = bCol End Function |