Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to save an Excel File with yesterdays date?

Status
Not open for further replies.

Smoothas

IS-IT--Management
May 1, 2002
93
GB
Hello,

I have the following macro that saves the current excel file in a specific location, with todays date in the file name. Great. BUT, I'm trying to get it to save with yesterdays date.
I've tried assigning variables and the like, but no luck.
Can anyone else shed any light for me.

The code i am currently using is :-

Sub Save()
'
Dim strFileB

strFileB = Format$(Date, "yy-mm ")
Const sPATH As String = "c:\"
Const sFILE As String = "Fulfillment"
Const sVAR As String = ""
ActiveWorkbook.SaveCopyAs sPATH & strFileB & sVAR & _
Format(Now, "dd-mm-yy ") & sFILE & ".xls"
ActiveWorkbook.Close
End Sub

thanks in advance
 
Code:
    ActiveWorkbook.SaveCopyAs sPATH & strFileB & sVAR & _
                Format(Now-1, "dd-mm-yy ") & sFILE & ".xls"


combo
 
arrhh... so close, but yet, so far.
Thanks for the Uber fast response.
Works like a dream now.

Thanks again Combo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top