Avariation on current Macro to save file
Posted on 2014-09-15
I use the below macro which was given to me by IrogSinta on EE, to save files where the date and month change
In my current project I need to save files that are forward dated 3 days but I do not want to save with weekend dates. i.e. on Wed I need to save with Mondays date, Thurs with Tues and Friday with Wed.
Could the below code be amended to do this.
Dim sFilename As String
Dim sPath As String
sFilename = "myWorkbook.xls" 'Set filename
sPath = "C:\rights\Mkt\Break\" 'Set base path
If Right(sPath, 1) <> "\" Then sPath = sPath & "\" 'Check for "\"
sPath = sPath & Format(Date, "yyyy\\mm mmm\\")
If Dir(sPath, vbDirectory) = "" Then 'If folder doesn't exist, create it
Shell "cmd /c mkdir """ & sPath & """"
ActiveWorkbook.SaveAs sPath & Format(Date, "mmddyyyy_") & sFilename