VBA erroneously adds slashes to formatted date

Viewed 76

A file is created every Friday with the formatting: "Report 08 11 2017.xlsx"

Dim iWeekday As Integer, LastFridayDate As Date
iWeekday = Weekday(Now(), vbFriday)

LastFridayDate = Format(Now - (iWeekday - 1), "mm dd yyyy")

LastFridayDate is formatted the way it appears in the file path, as '08 11 2017'. However, when i attempt to open the workbook via:

Dim lw_report As Workbook

Set lw_report= Workbooks.Open("Report " & LastFridayDate & ".xlsx")

I get error: "Report 08\22\2017.xlsx" cannot be found

How can I get the file path created so that the spaces are preserved?

1 Answers
Related