LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Save a bakup file when opening the file

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save Excel file to a CSV without opening it first Jodie Excel Programming 0 January 6th 10 07:48 PM
File:1 and File:2 -- Double Files when Opening One File dallin Excel Discussion (Misc queries) 1 January 25th 07 02:53 AM
opening an excel file opens a duplicate file of the same file skm Excel Discussion (Misc queries) 1 December 7th 05 05:52 PM
Excel marcos firing on file save as but not file save Andy Excel Programming 1 August 3rd 04 10:34 AM
Save File to Another Directory, but not change Users File Save location Mike Knight Excel Programming 1 May 28th 04 09:06 PM


All times are GMT +1. The time now is 09:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"