How to convert Hex value to ascii?

# Thread: How to convert Hex value to ascii?

1. Joe
Senior Member
Join Date
Dec 1969
Posts
553

## How to convert Hex value to ascii?

I can convert ascii to Hex, but I can&#039;t figure out how to go back. <BR><BR>Any ideas? I have been searching this board, and found how to go from Hex to binary...but not to ascii<BR><BR>Thanks,<BR><BR>Joe

2. Senior Member
Join Date
Dec 1969
Posts
96,118

## to ASCII??? or to number?

&#060;%<BR>theHex = "7FA9" &#039; or however you got it!<BR>theNumber = CLng( "&amp;H" & theHex )<BR>%&#062;<BR><BR>What do you mean by "to ASCII"??? Like the ASC function? But then theNumber in above code is the same as ASC...an integer...if the hex value is in range.<BR><BR>Or do you mean you want a CHARACTER that corresponds to the given hex value? If so, just do CHR(theNumber) after getting theNumber as above. Or, more compactly:<BR><BR>&#060;%<BR>ch = CHR( CINT( "&amp;H" & theHex ) )<BR>%&#062;<BR><BR>This all works because VBS recognizes &H187A et al. as legal integer values!<BR><BR>This *IS* explained, though briefly, in the VBS docs.<BR><BR>http://msdn.microsoft.com/scripting/default.htm?/scripting/vbscript/doc/vbstoc.htm<BR><BR>Click on FUNCTIONS, click on HEX function, read this:<BR><BR>*** QUOTE ***<BR>You can represent hexadecimal numbers directly by preceding numbers in the proper range with &H. For example, &H10 represents decimal 16 in hexadecimal notation.<BR>*** END QUOTE ***<BR><BR>

3. Joe
Senior Member
Join Date
Dec 1969
Posts
553

## Thanks Bill, I will study the DOC also...

.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•