Matthew answered how to convert to ANSI, but if you want the resulting byte array to still represent the original Unicode string, you just assigned it directly:
Public Sub Main() Dim b() As Byte Dim s As String s = "Whatever" b = s 'Assign Unicode string to bytes.' s = b 'Works in reverse, too!' Debug.Print s End Sub
That's all. You end up with a 16-element byte array, each subsequent pair describing one Unicode character.
Karl E. Peterson
source share