Jackblack1
Active Member
- Joined
- Feb 10, 2004
- Messages
- 266
Hi All
I have a macro that saves a workbook according to yesterdays date automatically when a button is clicked. The problem is this macro does not exclude weekend dates. I need it exclude weekend dates so that on Monday it is save according to Fridays date.(see macro below)
Then I am trying to create a macro that will go back and retrieve the prior dates saved workbook, this happens each day. One important thing, if it monday then it will retrieve fridays. How can this be done?
sPath = "R:\FACSAPPS\FA\CUS\STL\DIRECT PROGRAM\Exemptive Order\2007\"
If Dir(sPath & Format(Date, "mmm yy"), vbDirectory) = "" Then
VBA.MkDir (sPath & Format(Date, "mmm yy"))
End If
sPath = sPath & Format(Date, "mmm yy") & "\"
sFileName = Format(Now(), "mmddyy") & " -exe.xls"
ActiveWorkbook.SaveAs Filename:=sPath & sFileName, FileFormat:= _
xlExcel9795, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sorry for the confusion but it is the best I could do explaining this.
Thanks
I have a macro that saves a workbook according to yesterdays date automatically when a button is clicked. The problem is this macro does not exclude weekend dates. I need it exclude weekend dates so that on Monday it is save according to Fridays date.(see macro below)
Then I am trying to create a macro that will go back and retrieve the prior dates saved workbook, this happens each day. One important thing, if it monday then it will retrieve fridays. How can this be done?
sPath = "R:\FACSAPPS\FA\CUS\STL\DIRECT PROGRAM\Exemptive Order\2007\"
If Dir(sPath & Format(Date, "mmm yy"), vbDirectory) = "" Then
VBA.MkDir (sPath & Format(Date, "mmm yy"))
End If
sPath = sPath & Format(Date, "mmm yy") & "\"
sFileName = Format(Now(), "mmddyy") & " -exe.xls"
ActiveWorkbook.SaveAs Filename:=sPath & sFileName, FileFormat:= _
xlExcel9795, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sorry for the confusion but it is the best I could do explaining this.
Thanks