Viewing Individual Non-printable characters from a String in Hexadecimal

R

Roger Henfrey

I'm using VBA 6.3 and would be most grateful for help in how to view individual non-printable bytes from a string in readable hexadecimal format. Every way I try it I get type conversion errors.

E.g. How would I be able to see the following character in hexadecimal :

Left$(strMyString,1)
 
J

jaf

Hi Roger,
First off, if it is non-printable, it usually does not have a visual char
that can be "seen".
Here is one way to get the hex value of the unknow char.

Sub test()
Dim stLen, MyHex, MyStr, MyChr

stLen = Len(Cells(1, 1).Text)
MyStr = Cells(1, 1).Text

For i = 1 To stLen
MyHex = Mid(MyStr, i, 1)
MyChr = Hex(Asc(MyHex))
' REM print the character, hex value, ASCII value
Debug.Print MyHex, MyChr, Asc(MyHex)
Next
End Sub



--
John
johnf 202 at hotmail dot com


| I'm using VBA 6.3 and would be most grateful for help in how to view
individual non-printable bytes from a string in readable hexadecimal format.
Every way I try it I get type conversion errors.
|
| E.g. How would I be able to see the following character in hexadecimal :
|
| Left$(strMyString,1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top