Showing posts with label From A Folder. Show all posts
Showing posts with label From A Folder. Show all posts

Monday, April 15, 2019

Open Last Modified Excel File From A Folder Through Vba

Dear All,

We can use below vba code to open last modified excel file from a folder.

Sub Last_Modified_File()
x = InputBox(“put Folder Path”)
folder_name = x & “\”
flname = Dir(folder_name & “*.xlsx”)
Do While Len(flname) > 0
dttime = FileDateTime(folder_name & flname)
If dttime > qq Then
qq = dttime
End If
flname = Dir()
Loop
folder_name = x & “\”
flname = Dir(folder_name & “*.xlsx”)
Do While Len(flname) > 0
dttime = FileDateTime(folder_name & flname)
If qq = dttime Then
‘qst = folder_name & flname
Workbooks.Open folder_name & flname
Exit Sub
End If
flname = Dir()
Loop
End Sub

Over 50 Ebooks Excel and VBA free Download

1. Statistics and Probability for Engineering Applications With Microsoft Excel by W.J. DeCoursey - PDF Free Download Download Siz...