Jagwarman
asked on
Avariation on current Macro to save file
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.
Sub monthFolder()
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 & """"
End If
ActiveWorkbook.SaveAs sPath & Format(Date, "mmddyyyy_") & sFilename
End Sub
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.
Sub monthFolder()
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 & """"
End If
ActiveWorkbook.SaveAs sPath & Format(Date, "mmddyyyy_") & sFilename
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Has this tested ok?
ASKER
Sorry got caught on something else. This is brilliant many thanks John.
ASKER
Brilliant piece of work thanks
ASKER