The editor is ANSI only, although all VBA string are Unicode internally.
So, whilst VBA variables are able to hold the correct Unicode text, the
VB
editor is not able to display them; hence the "???"
Dim TempStr as string
TempStr=Range("A1").Value 'Which holds some Korean (Unicode) text
Debug.Print TempStr
????
So if you need to work with actual text outside of that range in the VBE,
you need to use Hex value and ChrW/byte arrays.
You can use a WS cell instead of the Immediate window to see Unicode values.
In your case, it may be better to resort to the API to get the MyDocuments
folder, but use the W version of the API:
http://forums.devx.com/archive/index.php/t-37771.html
NickHK
"RyanG" wrote in message
...
How do I handle Korean script in the Excel Vba code?
Specifically, I am trying to save a document to a file directory that has
a
Korean text in the directory path. I.e., C:\Documents and Settings\???\My
Documents. However, when I record the macro just to see how Excel would
write the code, the Korean text turns into ???, i.e. ActiveWorkbook.SaveAs
Filename:= _
"C:\Documents and Settings\???\My Documents\Book5.csv",
FileFormat:= _
xlCSV, CreateBackup:=False
Indeed, re-running the recorded macro causes an error because ??? is not a
valid directory name. I don't like hard coding names, so even when I use
a
variable to pick up the directory name from a cell, hovering the mouse
over
the variable when in step mode, indicates that the Korean letters are not
recognized and the variable value becomes ???.
I have the Korean IME loaded, so I can type the Korean characters in most
programs, but not in Vba.
Along these same lines, I want to use MsgBox(Msg, Style, Title) to display
the message in Korean, but again, the Korean letters can not be entered
directy into the Vba script, nor passed using a variable.
Is it possible for Korean letters to be handled with Vba? If so how?
Thanks for any help that is given!