Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default set unicode in macro

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default set unicode in macro

Use Chr(). For example:

Sub dural()
ActiveCell.Font.Name = "Arial Unicode MS"
ActiveCell.Value = ChrW(8457)
End Sub

will put a degrees Fahrenheit symbol in a cell.




--
Gary''s Student - gsnu200909


"GadyC" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I want to define the use of Unicode globally in a VBA macro in Ex. Genealogyman Excel Programming 1 May 26th 09 03:56 PM
how do I use macro to find and replace unicode characters CliffG Excel Discussion (Misc queries) 13 April 2nd 09 07:44 PM
Changing a macro to save as Unicode text Wei-Dong Xu [MSFT] Excel Programming 0 January 21st 04 05:55 AM
Changing a macro to save as Unicode text Jim Rech Excel Programming 0 January 20th 04 02:43 PM
A macro to export a sheet as UTF8 encoded Unicode file Dario de Judicibus Excel Programming 5 November 21st 03 07:11 AM


All times are GMT +1. The time now is 01:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"