Search code examples
vbaspecial-characters

MsgBox with Scripting.FileSystemObject's File.Path does not display Cyrillic characters


I am walking through all files in a folder. When I hit a file name that includes these special characters "Информационное письмо" the special characters are turned into "?" - question marks. Please how can I get the original file name this way?

Code:

Dim objFolder As Object
Dim objFile As Object
Dim objFSO as Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\test")
For Each objFile In objFolder.Files
    MsgBox objFile.Path 
next objFile

Solution

  • Choose the correct codepage for Non Unicode Programs in Regional Settings.

    All API calls are ANSI. MsgBoxA is an ANSI function.