Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello
I am trying to open the most recent file in a folder. I have found 2 possible solutions here but neither seem to work for me. First: Const FilePath = "Mypath" Workbooks.Open Filename:=FindNewestFile(FilePath) This one gives me Undefined sub or function on FindNewestFile The other: With Application.FileSearch .NewSearch .LookIn = "C:\" .Filename = "*.jnk" .Execute SortBy:=msoSortBySize .NewSearch .LookIn = "mypath" .SearchSubFolders = False .FileType = msoFileTypeExcelWorkbooks If .Execute(SortBy:=msoSortByLastModified, SortOrder:=msoSortOrderDescending) 0 Then MsgBox "The newest file is " & .FoundFiles(1) & " created " & FileDateTime(.FoundFiles(1)) Workbooks.Open .FoundFiles(1) Else MsgBox "There were no files found." End If End With This one gives me "Object doesn't support this action" on With Application.FileSearch Can anyone help? Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Open Recent | Excel Discussion (Misc queries) | |||
how do i delete a file from recent documents file in excel | New Users to Excel | |||
Open recent files | Excel Discussion (Misc queries) | |||
Macro to open most recent file with a particular filename string | Excel Discussion (Misc queries) | |||
open an exel workbook from my recent documents | Excel Discussion (Misc queries) |