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!!!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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:
Upvote 0

Forum statistics

Threads
1,214,907
Messages
6,122,185
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top