Function C10ToRGB_1(lngColor As Long) As String Dim strR As String Dim strG As String Dim strB As String strR = lngColor Mod 256 strG = lngColor / 256 Mod 256 strB = lngColor / 256 / 256
C10ToRGB_1 = strR & "_" & strG & "_" & strB End Function
Sub test1() Debug.Print C10ToRGB_1(33023) Debug.Print RGB(255, 128, 0) End Sub
C10ToRGB = strR & "," & strG & "," & strB 'Debug.Print C10ToRGB End Function
'以下函数将 16 进制数值转换为 10 进制数值 Private Function C16To10(strA As String) As Double Dim a As Double Dim b As String Dim c As Double Dim l As Integer Dim i As Long l = Len(strA) For i = 1 To l b = Mid(strA, i, 1) Select Case b Case "A" b = 10 Case "B" b = 11 Case "C" b = 12 Case "D" b = 13 Case "E" b = 14 Case "F" b = 15 End Select c = c + b * 16 ^ (l - 1) l = l - 1 Next C16To10 = c 'Debug.Print C16To10 End Function