There is a function Hex() to convert decimal numbers to hexadecimal numbers, but there seems to be no function to convert hexadecimal into decimal. Does anyone know how to do this?
Printable View
There is a function Hex() to convert decimal numbers to hexadecimal numbers, but there seems to be no function to convert hexadecimal into decimal. Does anyone know how to do this?
Take a look at this link.
http://www.planet-source-code.com/vb...txtCodeId=2042
Wouldn't it be easier to do something like so:
just an idea. :)Code:
Public Function Hex2Dec(ByVal strHex As String, ByRef lngRet As Long) As Boolean
On Error Goto CON_ERR
'' return flag set as invalid data
Hex2Dec = False
'' this should cause an error if the hex string is invalid
lngRet = CLng("&H" & strHex)
'' return flag set as valid data
Hex2Dec = True
CON_ERR:
End Function