Using last business date to save
Posted by dan on October 25, 2001 10:12 AM
I am using the following code to attempt and save a file using the previous business day. The code I have below does not take into account weekends/holidays etc. I need to either have a business day counter(hard), or I can use the trade date which is listed on the sheet "Summary" ("b3"). How do I reference the date in cell ("b3") and then add it in place of the SaveAsFile =_ Application.Text(Now() - 1, "mm_dd ") below?
Thank you,
Dan
Private Sub ActualsButton_Click()
Dim SendPath, NameFile, SaveAsFile
Dim strZ As String
strZ = "PSF Trade Actuals"
On Error GoTo errorhandler
SendPath = "C:\"
NameFile = strZ
SaveAsFile = Application.Text(Now() - 1, "mm_dd ")
NameFile = SaveAsFile & NameFile & ".xls"
ChDir SendPath
ActiveWorkbook.SaveAs Filename:=SendPath & NameFile, _
FileFormat:=xlExcel9795, CreateBackup:=False
Unload Me
SaveAs = True
Exit Sub
errorhandler:
MsgBox "Your work has not been saved", vbCritical
End Sub