Home Managing problematic formatted international characters in filename
Reply: 0

Managing problematic formatted international characters in filename

Gowire
1#
Gowire Published in 2018-02-14 14:10:08Z

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 å,ä,ö.

Sub ScanFiles()
    Dim ExcelFile As String
    Dim WB As Workbook

    ExcelFile = Dir("c:\Somepath\*.xlsx")
    Do While ExcelFile <> ""
        Set WB = Workbooks.Open(ExcelFile)
        WB.Close False
    Loop
    ExcelFile = Dir()
End Sub

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?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.300356 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO