Private Sub Command1_Click()
'Num: (1=red, 2=green, 3=blue).
MsgBox GetRGB(RGB(255, 255, 255), 1)
MsgBox GetRGB(RGB(255, 9, 6), 2)
MsgBox GetRGB(RGB(255, 255, 7), 3)End Sub
Function GetRGB(RGBval As Long, Num As Integer) As Integer
If Num > 0 And Num < 4 And RGBval > -1 And RGBval < 16777216 Then
GetRGB = RGBval \ 256 ^ (Num - 1) And 255
End If
End Function
'Num: (1=red, 2=green, 3=blue).
MsgBox GetRGB(RGB(255, 255, 255), 1)
MsgBox GetRGB(RGB(255, 9, 6), 2)
MsgBox GetRGB(RGB(255, 255, 7), 3)End Sub
Function GetRGB(RGBval As Long, Num As Integer) As Integer
If Num > 0 And Num < 4 And RGBval > -1 And RGBval < 16777216 Then
GetRGB = RGBval \ 256 ^ (Num - 1) And 255
End If
End Function
R = ColorAnd &HFF&
G = (Color And &HFF00&) / &H100
G = (Color And &HFF0000) / &H10000
G = (Color And &HFF00&) / &H100
B = (Color And &HFF0000) / &H10000