I found this code on the forum a little time ago. It converts VB colours to HTML Colours (some kind of Hexadecimal value). Unfortunately I don't really understand its functionality, and I need a code that does the opposite: convert HTML Colours to VB Colours. Does anyone have such a code?
Thanks.
VB Code:
Public Function ForeColorHTML(Number As Long) As String Dim MyString As String, MyNum As Long, MyCalc As Long, MyRemainder As Long, X As Integer MyRemainder = Number MyString = "" For X = 2 To 0 Step -1 MyCalc = MyRemainder \ 256 ^ X MyString = Format$(Hex(MyCalc), "00") & MyString MyRemainder = MyRemainder - MyCalc * 256 ^ X Next txtForeColor.Text = MyString End Function




Reply With Quote