Сам нашел ответ на свой вопрос.
-
- Dim filename As String, path As String, filepath As String
-
- path = "G:\Logistic\Mpz\Материалы"
-
- With Application.FileSearch
- .LookIn = path
- .SearchSubFolders = True
- .FileType = msoFileTypeAllFiles
-
- If .Execute(SortBy:=msoSortByLastModified, _
- SortOrder:=msoSortOrderDescending) > 0 Then
- filepath = .FoundFiles(1)
- End If
- End With
-
- Application.Workbooks.Open (filepath)
-
- MsgBox "OK"
-
- filename = Mid(filepath, (Len(path) + 2))
-
- Workbooks(filename).Close SaveChanges:=False
-
Ответить
|