VBA, Chinese character error

PiggyChu620

New Member
Joined
Jan 24, 2019
Messages
5
I have a spreadsheet with a list of Chinese names, and a macro to read all those names into a array.
Most of the names worked fine, but there is one name contains the character 袝, and it become ? in the array.
I'm guessing that it contains some special character in the unicode.
Could somebody please be so kind and teach me how could I escape those special characters and read it correctly!?
Much appreciated!!!
 

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,477
Where did you see the "?"? In the debug window?

I put "劉明袝" in A1 and ran the following macro.

Code:
Sub test55()

Dim arr(0 To 2) As Variant

arr(0) = Sheets(2).Range("a1")
Sheets(2).Range("B1") = arr(0)

arr(1) = Sheets(2).Range("a2")
Sheets(2).Range("B2") = arr(1)

arr(2) = Sheets(2).Range("A3")
Sheets(2).Range("B3") = arr(2)

Sheets(2).Range("B4") = "天天吃飯看報"

End Sub
Though in the Debug window, arr(0) was shown as "劉明?", B1 actually contained "劉明袝". I then put the following three strings in A1 to A3 and ran the macro. Again, in the Debug window, all three "袝" were displayed as "?" but in B1 to B3, they all showed up correctly.

Some people claim VBA editor doesn't support Unicode. My example above (especially the line right above "End Sub") proves it does. Well, in the Control Panel in Windows, you can set up non-Unicode programs to support Unicode.

劉明袝
王袝生
袝學銘

<tbody>
</tbody>
 
Last edited:

Forum statistics

Threads
1,081,561
Messages
5,359,611
Members
400,539
Latest member
JimUSMC

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top