I have some files in a folder that seems to be formatted in a strange way when accessing them in VBA.
The code below is a simple test. It scans the Excel-files in a folder and simply opens and closing them again (just to test the problem). It works fine even if the filename contains Swedish characters such as å,ä,ö.
Dim ExcelFile As String
Dim WB As Workbook
ExcelFile = Dir("c:\Somepath\*.xlsx")
Do While ExcelFile <> ""
Set WB = Workbooks.Open(ExcelFile)
ExcelFile = Dir()
This works fine... until... this happens:
- One filename is listed as "Sömething.xlsx". Even if I take a detailed look in the file properties. It is really "Sömething.xlsx"!
- But the variable
ExcelFile stores "So¨mething.xlsx". The
Workbooks.Open command fails since the file with that name can't be found
It seems that the specific file has been saved in an Apple environment.
Why is this happening and how do I manage it?