'"Run-time error "53" - file not found" where file name includes special symbols from Turkish language
I have an Excel sheet which renames and moves files from folders. This works when the document contains "normal" symbols/letters. However, with the special symbols from Turkish language (e.g. Ğ,ğ,ş,ç) the macros give me
"Run-time error "53" - file not found".
How I normally proceed:
I get the data (Document name & Folder path) via import: "Data" - "Get Data" - "From File" - "From folder"
When performing the import Excel identifies the names with Turkish letters. The file name is identical between the document name and listed documents in the sheet.I run the macros.
(Column A = oldname; B = Extension; G = Newname; H = Folderpath)Excel renames the first 5 files (documents without specific turkish symbols) according to the script and then stops the renaming activity and prompts me with the error message.
If Excel is importing the data in the correct way, why is not finding the documents in the folder?
I narrowed the problem down and I am 99% sure that it is because of the special Turkish symbols. When replacing a couple documents with casual letters the macro always renames until there is a Turkish letter again.
Sub RenameAllFiles()
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
If .Show = -1 Then
selectDirectory = .SelectedItems(1)
dDirectory = selectDirectory & Application.PathSeparator
curRow = 2
dFile = Cells(curRow, "G")
Do Until dFile = ""
sFile = Cells(curRow, "A")
sDirectory = Cells(curRow, "H")
Name sDirectory & sFile As _
dDirectory & dFile
curRow = curRow + 1
dFile = Cells(curRow, "G")
Loop
End If
End With
Solution 1:[1]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ozgun Senyuva |


