Excel 2002 (10.6789.6735) SP3 Macro
I have a macro that makes a backup when it saves the active workbook.
On subsequent runs of the macro, the file - Backup of ! Jagerxxx V1.0.xlk is NOT overwritten! As a result I do not have a backup of the most current file. I would like to either: a: overwrite the previously created Backup - or b: Delete the backup workbook in the macro before recreating it again. This is the statement I use to save the workbook: ActiveWorkbook.SaveAs Filename:= _ "D:! Jagerxxx V1.0.xls", FileFormat:= _ xlNormal, Password:="", WriteResPassword:="" _ ,ReadOnlyRecommended:=False _ , CreateBackup:=True Many Thanks -- Occasionally stumped |
Excel 2002 (10.6789.6735) SP3 Macro
On Error Resume Next
Kill BackupFilename On Error goto 0 'now ActiveWorkbook.SaveAS . . . -- Regards, Tom Ogilvy "Two-Canucks" wrote in message ... I have a macro that makes a backup when it saves the active workbook. On subsequent runs of the macro, the file - Backup of ! Jagerxxx V1.0.xlk is NOT overwritten! As a result I do not have a backup of the most current file. I would like to either: a: overwrite the previously created Backup - or b: Delete the backup workbook in the macro before recreating it again. This is the statement I use to save the workbook: ActiveWorkbook.SaveAs Filename:= _ "D:! Jagerxxx V1.0.xls", FileFormat:= _ xlNormal, Password:="", WriteResPassword:="" _ ,ReadOnlyRecommended:=False _ , CreateBackup:=True Many Thanks -- Occasionally stumped |
Excel 2002 (10.6789.6735) SP3 Macro
I don't use that feature, but after doing some testing, I believe this
option just saves the previous copy of the workbook as a back up - not the latest copy . This appears to be different from what you want. Perhaps you want to use (make sure you uncheck create backup option in the saveas dialog). s = "! Jagerxxx V1.0.xls" Application.DisplayAlerts = False ActiveWorkbook.SaveCopyAS "D:\Backup Copy of " & s Application.DisplayAlerts = True ActiveWorkbook.Save Filename:=s Since this isn't the first save of the workbook and you not changing names, use Save rather than SaveAs. -- Regards, Tom Ogilvy "Two-Canucks" wrote in message ... I have a macro that makes a backup when it saves the active workbook. On subsequent runs of the macro, the file - Backup of ! Jagerxxx V1.0.xlk is NOT overwritten! As a result I do not have a backup of the most current file. I would like to either: a: overwrite the previously created Backup - or b: Delete the backup workbook in the macro before recreating it again. This is the statement I use to save the workbook: ActiveWorkbook.SaveAs Filename:= _ "D:! Jagerxxx V1.0.xls", FileFormat:= _ xlNormal, Password:="", WriteResPassword:="" _ ,ReadOnlyRecommended:=False _ , CreateBackup:=True Many Thanks -- Occasionally stumped |
Excel 2002 (10.6789.6735) SP3 Macro
I used the Kill feature, have tested it, and it works as I requested.
Thanks Tom -- Occasionally stumped "Tom Ogilvy" wrote: I don't use that feature, but after doing some testing, I believe this option just saves the previous copy of the workbook as a back up - not the latest copy . This appears to be different from what you want. Perhaps you want to use (make sure you uncheck create backup option in the saveas dialog). s = "! Jagerxxx V1.0.xls" Application.DisplayAlerts = False ActiveWorkbook.SaveCopyAS "D:\Backup Copy of " & s Application.DisplayAlerts = True ActiveWorkbook.Save Filename:=s Since this isn't the first save of the workbook and you not changing names, use Save rather than SaveAs. -- Regards, Tom Ogilvy "Two-Canucks" wrote in message ... I have a macro that makes a backup when it saves the active workbook. On subsequent runs of the macro, the file - Backup of ! Jagerxxx V1.0.xlk is NOT overwritten! As a result I do not have a backup of the most current file. I would like to either: a: overwrite the previously created Backup - or b: Delete the backup workbook in the macro before recreating it again. This is the statement I use to save the workbook: ActiveWorkbook.SaveAs Filename:= _ "D:! Jagerxxx V1.0.xls", FileFormat:= _ xlNormal, Password:="", WriteResPassword:="" _ ,ReadOnlyRecommended:=False _ , CreateBackup:=True Many Thanks -- Occasionally stumped |
All times are GMT +1. The time now is 10:52 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com