Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks mates,
I've combined your replys in something that works for my situation Luc "Don Guillett Excel MVP" schreef in bericht ... On Dec 16, 3:07 pm, Per Jessen wrote: This is an event code which has to be inserted in ThisWorkbook code sheet: Private Sub Workbook_Open() Dim fName As String Dim MyDate As String fName = ThisWorkbook.Name fName = Left(fName, Len(fName) - 4) MyDate = Format(Date, "dd-mmm-yyyy") Application.DisplayAlerts = False ThisWorkbook.SaveAs fName & "-" & MyDate & ".xls" Application.DisplayAlerts = True End Sub On 16 Dec., 21:52, "Mijn_Newsgroepen" wrote: When i open a certain file i want that immediately a backup of this file is saved to the same folder but with the date that the file was opened added. Example : file name is "file1.xls". When this file is opened on 16-dec, i want a backup saved under the name "file1-16-dec-2010.xls" When the file is opened a second or third,... time on the same day, then the backup file "file1-16-dec-2010.xls"has to be overwritten whitout asking Who can provide me with some code? Thanks, Luc- Hide quoted text - - Show quoted text - You may prefer to use save copy AS. Here is one I have used. Modify to suit Sub Backup() 'kept in personal.xls & assigned to toolbar button On Error GoTo BackupFile MkDir CurDir & "\Backup" BackupFile: With ActiveWorkbook MyWB = .Path & "\BACKUP\" & .Name .SaveCopyAs MyWB .Save End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Save Excel file to a CSV without opening it first | Excel Programming | |||
File:1 and File:2 -- Double Files when Opening One File | Excel Discussion (Misc queries) | |||
opening an excel file opens a duplicate file of the same file | Excel Discussion (Misc queries) | |||
Excel marcos firing on file save as but not file save | Excel Programming | |||
Save File to Another Directory, but not change Users File Save location | Excel Programming |