• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Saving Workbook and appending date

David Jenkins

New Member
Hi there,

I've been playing with a lot of code that I have found in google but I keep breaking them or getting undesired results.

Basically, from VBA I want the workbook to Save a copy of its to a network drive in a folder called Archives, with yesterdays date appended to the filename: CallsVConversion and then I want the workbook to close itself and ignore any prompts.

Like i say I found all types of code and trying to put them all together it just doesnt work.

Regards,

Dave.
 
I believe this is what you are looking for, or at least close.
Code:
Sub MakeCopy()
Dim myPath As String
Dim myName As String
'Where are we saving to?
myPath = ThisWorkbook.Path & "\archives\"
'What is the name of new book?
myName = ThisWorkbook.Name & Format(Date - 1, "yyyymmdd")

ThisWorkbook.SaveCopyAs myPath & myName
ThisWorkbook.Close False 'Close w/o saving
End Sub
 
Back
Top