Hi,
I have excel files which containing chinese characters. When i run code on these files i get an error while saving. Showing me that file "Some filename ?????" can not be found. It seems it converts chinese characters to question marks.
I tried a regex as seen below to remove the chinese pattern or question marks with string - 9 characters because that would remove them always. ( i also tried [\u4E00-\u9FFF]) But i can not use the name as function because the name in the variable Fname with ???? is different from the actual file in my folder which has chinese characters, which i can not get in a variable. How do i get around this?. See my code below.
Sub LoopThroughFiles()
Dim FName As Variant
Dim strNew As String
Dim strDir As String
strDir = "C:\Users\samjanss\Documents\Proberen\chinese trein\"
FName = Dir(strDir & "*.*")
Do While Len(FName) > 0
strNew = Left(FName, Len(FName) - 9)
Debug.Print strNew
Debug.Print FName
If StrComp(strNew, FName) <> 0 Then Name (strDir & FName) As (strDir & strNew)
FName = Dir
Loop
End Sub
Bookmarks