给你写了个函数
Function getStrColor(ByVal lngColor As Long) As String
Dim strRed As String, strGreen As String, strBlue As String
strRed = Hex(lngColor And 255)
If Len(strRed) = 1 Then strRed = "0" & strRed
strGreen = Hex(lngColor And 65280)
If Len(strGreen) = 3 Then
strGreen = "0" & Left(strGreen, 1)
Else
strGreen = Left(strGreen, 2)
End If
strBlue = Hex(lngColor And 16711680)
If Len(strBlue) = 5 Then
strBlue = "0" & Left(strBlue, 1)
Else
strBlue = Left(strBlue, 2)
End If
getStrColor = "#" & strRed & strGreen & strBlue
End Function
试一下:
Private Sub Form_Load()
Dim lngColor As Long
lngColor = 12453343
Debug.Print getStrColor(lngColor)
End Sub