WIN 10(Korea)
EXCEL 2016 & VBA
VBA doesn't read chinese character folder and files .
Korean & English isn't show any issue.
Doesn't VBA support chinese?

WIN 10(Korea)
EXCEL 2016 & VBA
VBA doesn't read chinese character folder and files .
Korean & English isn't show any issue.
Doesn't VBA support chinese?


Dim bi As BROWSEINFO
Dim pidl, Path As String * 512
bi.lpszTitle = "Directory"
bi.ulFlags = BIF_RETURNONLYFSDIRS
pidl = SHBrowseForFolder(bi)
lResult = SHGetPathFromIDList(ByVal pidl, ByVal Path)
If lResult Then
TextBox1.Value = Path
WriteFiles
End If
Exit Sub
Path and file in the picture. VB read EN and KR but chinese are show "?"
In my think that language problem.
If you mean that “?” are shown in Watch window of Debugger, I think that you can ignore this issue. Check if the value is correct in TextBox1.
It seems that you are using external functions. Show the definitions of SHBrowseForFolder, SHGetPathFromIDList, BROWSEINFO.
By the way, you shown a picture that reflects a run-time error. Which line generates the error?
Maybe it will work if you use the Unicode version of the functions.
I have the 64-bit Excel; the next modifications seems to help:
Public Type BROWSEINFO
hWndOwner As LongPtr
pidlRoot As LongPtr
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfnCallback As LongPtr
lParam As LongPtr
iImage As Long
End Type
Public Declare PtrSafe Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderW" (lpBrowseInfo As BROWSEINFO) As LongPtr
Public Declare PtrSafe Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListW" (ByVal pidList As LongPtr, ByVal lpBuffer As String) As Boolean
Public Const BIF_RETURNONLYFSDIRS = &H1
Public Const MAX_PATH = 260
‘ . . . .
Dim bi As BROWSEINFO
Dim pidl, Path As String
Path = Space(MAX_PATH * 2)
bi.lpszTitle = "Directory"
bi.ulFlags = BIF_RETURNONLYFSDIRS
pidl = SHBrowseForFolder(bi)
Dim lResult As Long
lResult = SHGetPathFromIDList(ByVal pidl, ByVal Path)
If lResult Then
Path = StrConv(Path, vbFromUnicode)
TextBox1.Text = Path
End If
The checked folder name — “文件夹”— was displayed correctly in textbox. (However, the MsgBox and the Debugger are not able to display it).
Really Thanks for your help.
Unfortunately, I can't modified your codes. The path of the folder is mixed of Unicode(Chinese) and ASCII code.
ex) G:\2021\2_VBA\한글\中文\圆圆圆.txt
Last VBA shows : G:\2021\2_VBA\한글\??\???.txt
All value is broken after convert Unicode.
Current VBA shows : G:\2021\2_VBA\???\???\???.txt
I can't change my development conditions and usually used ASCII condition.
2 people are following this question.