How can we back up a permanant copy of an excel file automaticaly
How can we back up an excel file in our hard disk without using SAVE AS
command in our hard disk each time we close the file. I want to have a update copy of the excel file on my hard disk without others know that this file is being backuped up some where in the hard disk while closing it. THANK YOU |
hi
end the workbook before close event.... Private Sub Workbook_BeforeClose(Cancel As Boolean) ActiveWorkbook.SaveAs Filename:="YourfullFilePathAndName", _ FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False End Sub regards FSt1 "Gita" wrote: How can we back up an excel file in our hard disk without using SAVE AS command in our hard disk each time we close the file. I want to have a update copy of the excel file on my hard disk without others know that this file is being backuped up some where in the hard disk while closing it. THANK YOU |
I would have used the workbook_beforesave event.
Option Explicit Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) On Error Resume Next MkDir "C:\mybackups" Me.SaveCopyAs Filename:="c:\mybackups\mynamehere.xls" On Error GoTo 0 End Sub This code goes under the ThisWorkbook module. And it overwrites the previous backup (if it exists) each time you save your file. If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm Gita wrote: How can we back up an excel file in our hard disk without using SAVE AS command in our hard disk each time we close the file. I want to have a update copy of the excel file on my hard disk without others know that this file is being backuped up some where in the hard disk while closing it. THANK YOU -- Dave Peterson |
All times are GMT +1. The time now is 09:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com