![]() |
Backup file in folder
Is there any macro when i run it will take a backup of
my excel file in c:\mydata folder. Thanks in Advance. ****al |
Backup file in folder
****al,
Try something like ThisWorkbook.SaveCopyAs filename:="C:\mydata\" & Thisworkbook.Name -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "****al" wrote in message ... Is there any macro when i run it will take a backup of my excel file in c:\mydata folder. Thanks in Advance. ****al |
Backup file in folder
Here is a macro I use to backup to the active folder. 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 "****al" wrote in message ... Is there any macro when i run it will take a backup of my excel file in c:\mydata folder. Thanks in Advance. ****al |
Backup file in folder
****al,
See the code below. This will save the backup with a date/time appended to the name, to allow multiple backups. HTH, Bernie MS Excel MVP Sub BUandSave() 'Saves the current file to "mydata" backup folder and its own folder Application.DisplayAlerts = False ActiveWorkbook.SaveCopyAs FileName:="C:\mydata \" & _ Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4) & _ " BU " & Format(Now, " yyyy-mm-dd hh-mm") & ".xls" ActiveWorkbook.Save Application.DisplayAlerts = True End Sub "****al" wrote in message ... Is there any macro when i run it will take a backup of my excel file in c:\mydata folder. Thanks in Advance. ****al |
Backup file in folder
****al
Sub BUandSave2() 'Saves the current file to a backup folder and the default folder if desired 'Note that any previous backup is overwritten Application.DisplayAlerts = False ActiveWorkbook.SaveCopyAs FileName:="C:\mydata\" & _ ActiveWorkbook.Name ''ActiveWorkbook.Save''add this line if you want to save to default folder also Application.DisplayAlerts = True End Sub Gord Dibben XL2002 On Mon, 3 Nov 2003 04:11:22 -0800, "****al" wrote: Is there any macro when i run it will take a backup of my excel file in c:\mydata folder. Thanks in Advance. ****al |
All times are GMT +1. The time now is 03:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com