Link to home
Start Free TrialLog in
Avatar of Jagwarman
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
ASKER CERTIFIED SOLUTION
Avatar of johnb25
johnb25
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jagwarman
Jagwarman

ASKER

thanks looks good John but I can't test it fully until tomorrow. Never the less I will accept it and give you the points now. regards
Has this tested ok?
Sorry got caught on something else. This is brilliant many thanks John.
Brilliant piece of work thanks