I am trying to save a file into folder & sub folder that has dynamic names.
Structure of my folder & sub folder is
Shared Drive -> Main -> Year (i.e. 2018) -> Month (i.e. 09 September).
I wish to save in last month's folder since data comes from last month. I want to save the file name as PIF_09.30.2018 so using end of last month's dates.
I am getting an error
object doesn't support this property or method.
Sub Save_wkb()
Dim Path As String
ActiveWorkbook.SaveAs "S:\Main\" & Format(Now(), "YYYY") & _
Application.PathSeparator & Format(WorksheetFunction.Month(Now, -1), "MM ") & _
Format(WorksheetFunction.Month(Now, -1), "MMMM") & _
Application.PathSeparator & "PIF_" & _
Format(WorksheetFunction.EoMonth(Now, -1), "MM.D.YYYY") & ".xlsx", _
FileFormat:=51
End Sub