FileSystemObject.GetFile () получает ошибку «файл не найден», если вы вызываете его по имени файла с одиночной кавычкой / апострофом, то есть:
FileSystemObject.GetFile("D:\somepath\some file with an ' apostrophe in it.txt")
Вот что я пытаюсь:
Public Sub VBA_GetFileInfo(FileName As String, ByRef outDateCreated As Date, ByRef outDateAccessed As Date, ByRef outDateModified As Date, ByRef outFileSize As Long)
Dim tmpFile As String
'SOME THINGS I'VE TRIED TO OVERCOME THE PROBLEM, WITH NO SUCCESS:
'tmpFile = """" & FileName & """"
'tmpFile = FileName
'tmpFile = Replace(tmpFile, "\", "\\")
'tmpFile = Replace(tmpFile, "'", "\'")
Dim fso As FileSystemObject
Dim f As file
Dim s As String
Set fso = New FileSystemObject
----> BLOWS UP HERE with "file not found" error:
Set f = fso.GetFile(tmpFile)