jason1000rr
New Member
- Joined
- Sep 2, 2016
- Messages
- 14
Hi Everyone--
Looking for guidance to open file with the latest date within its name. Below is what I am working with. I typed "Latest Date" where in name it would go. Name is always recent to current month, but date is older. Any help would be much appreciated. Thank you
Fname = "\\global.corp.net\someplace\someplaceProcurement\IQR\IQR " & LatestDate & ".xlsx"
Set wbb = Workbooks.Open(Filename:=Fname, UpdateLinks:=False, Notify:=False)
For Each wb In Application.Workbooks
I used below for another file I used to work with and it worked for when it was current date. But, not able to figure out for latest date.
Dim curDate As String, Fname As String
curDate = Format(Date, "yyyy-mm-dd")
Dim wba As Workbook, wbb As Workbook, wbc As Workbook, wbd As Workbook, wbe As Workbook, wbf As Workbook, wb As Workbook
Fname = "Y:\Consumables\corporation\DMC\DMC - Planning & Materials\On Hand Reports\DMC Site\" & curDate & "_INV_R12_DMC_Onhandreport.xlsx"
Set wba = Workbooks.Open(Filename:=Fname, UpdateLinks:=False, Notify:=False)
Looking for guidance to open file with the latest date within its name. Below is what I am working with. I typed "Latest Date" where in name it would go. Name is always recent to current month, but date is older. Any help would be much appreciated. Thank you
Fname = "\\global.corp.net\someplace\someplaceProcurement\IQR\IQR " & LatestDate & ".xlsx"
Set wbb = Workbooks.Open(Filename:=Fname, UpdateLinks:=False, Notify:=False)
For Each wb In Application.Workbooks
I used below for another file I used to work with and it worked for when it was current date. But, not able to figure out for latest date.
Dim curDate As String, Fname As String
curDate = Format(Date, "yyyy-mm-dd")
Dim wba As Workbook, wbb As Workbook, wbc As Workbook, wbd As Workbook, wbe As Workbook, wbf As Workbook, wb As Workbook
Fname = "Y:\Consumables\corporation\DMC\DMC - Planning & Materials\On Hand Reports\DMC Site\" & curDate & "_INV_R12_DMC_Onhandreport.xlsx"
Set wba = Workbooks.Open(Filename:=Fname, UpdateLinks:=False, Notify:=False)