View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff[_3_] Harald Staff[_3_] is offline
external usenet poster
 
Posts: 4
Default set unicode in macro

Here is one way:

Sub test()
Dim S1 As String
Dim S2() As Byte
Dim L As Long

S1 = "Hello World"
'to unicode:
S2 = StrConv(S1, vbUnicode)

' byte array in the immedate window:
For L = LBound(S2) To UBound(S2)
Debug.Print L, S2(L), Chr(S2(L))
Next

'convert back:
S1 = StrConv(S2, vbFromUnicode)
MsgBox S1
End Sub

HTH. Best wishes Harald


"GadyC" skrev i melding
...
I wrote a macro - xla.
it returns manipulated and translated strings.
after passing to win7 i get the output in wrong language code, probably
unicode problem.

how can i assign a unoicode string into a varialble?

thanks in advance