I think I've used StrConv to convert strings to byte arrays and back in the past but actually the following code does as well.
'With thanks to user couttsj at vbforums.com
Public Function UniToByte(strInput As String) As Byte()
UniToByte = strInput
End Function
Public Function ByteToUni(bArray() As Byte) As String
ByteToUni = bArray
End Function
Try it from the Immediate Window
?ByteToUni(UniToByte("Hello"))
Hello
No comments:
Post a Comment