RGBToHex



Function RGBtoHEX(RGBValue)
Dim B As Integer
a = Hex(RGBValue)
B = Len(a)
If B = 5 Then a = "0" & a
If B = 4 Then a = "00" & a
If B = 3 Then a = "000" & a
If B = 2 Then a = "0000" & a
If B = 1 Then a = "00000" & a
RGBtoHEX = a
End Function

Private Sub Command1_Click()
CommonDialog1.ShowColor
MsgBox RGBtoHEX(CommonDialog1.Color)
End Sub

(rgbtohex.html)- by Paolo Puglisi - Modifica del 25/3/2019