Microsoft KB Archive/279115

= How To Use CLng to Convert Hexadecimal Number back to Decimal in VBScript =

Article ID: 279115

Article Last Modified on 8/8/2007

-

APPLIES TO


 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 4.01 Service Pack 1
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.01
 * Microsoft Internet Explorer (Programming) 5.01 SP1
 * Microsoft Internet Explorer 5.5

-



This article was previously published under Q279115



SUMMARY
In Microsoft Visual Basic Scripting Edition (VBScript), you can use the Hex function to convert a decimal to a hexadecimal number. This article contains sample code that converts 32-bit signed hexadecimal values back to decimal.



MORE INFORMATION
To convert a decimal to a hexadecimal number, use the VBScript Hex function. To convert a hexadecimal number to a decimal, use the VBScript data type conversion functions, CInt and CLng, as follows:  



Sub Hex_to_Dec(hex_value)

MsgBox CLng(&quot;&h&quot; & hex_value)

End Sub

 Convert Hex to Decimal:  

 

