Captain_Conman
Board Regular
- Joined
- Jun 14, 2018
- Messages
- 54
Hi There,
I am essentially trying to open a workbook saved as today's date. "7-2-18.xlsx" I have written the follow code and it works perfectly. However, it is trying to reference a file with the year as "2018" instead of just "18". Any suggestions on how to make the macro reference "18" instead of "2018"?
Sub Test()
Dim M As Integer
Dim D As Integer
Dim Y As Integer
M = Month(Date)
D = Day(Date)
Y = Year(Date)
Application.Workbooks.Open Filename:="S:\SherwinWilliams\Oracle Reports" & M & "-" & D & "-" & Y & ".xlsx"
End Sub
I am essentially trying to open a workbook saved as today's date. "7-2-18.xlsx" I have written the follow code and it works perfectly. However, it is trying to reference a file with the year as "2018" instead of just "18". Any suggestions on how to make the macro reference "18" instead of "2018"?
Sub Test()
Dim M As Integer
Dim D As Integer
Dim Y As Integer
M = Month(Date)
D = Day(Date)
Y = Year(Date)
Application.Workbooks.Open Filename:="S:\SherwinWilliams\Oracle Reports" & M & "-" & D & "-" & Y & ".xlsx"
End Sub