save document which a date and deleted the old document

  • Thread starter Thread starter 't Klimmertje
  • Start date Start date
T

't Klimmertje

I like to save an excel document with the name which is in A1 and the date
of today which is in B1
The old document must be deleted
Who can help
Thanks
Peter
 
Here's a way:

Sub SaveAndDate()
Dim lStr_CurFileName As String

With ThisWorkbook
lStr_CurFileName = .FullName
.SaveAs .Path & "\" & Range("Sheet1!A1") & " " &
Format(Range("Sheet1!B1"), "yyyymmdd") & ".Xls"
End With

Kill lStr_CurFileName

End Sub



--
Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"
 
Back
Top