![]() |
BeforeClose event - Savings
I want to save a copy of a spreadsheet in a different location, after I
update it. I put code in the BeforeClose event, so it saves the file in the desired location. The problem I have is it saves the BeforeClose event also. Is there anyway to make a backup copy of the file and not include the code in the backup copy? |
BeforeClose event - Savings
Here is a backup macro I use.
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 "Mike" wrote in message news:5o1cb.556043$YN5.374683@sccrnsc01... I want to save a copy of a spreadsheet in a different location, after I update it. I put code in the BeforeClose event, so it saves the file in the desired location. The problem I have is it saves the BeforeClose event also. Is there anyway to make a backup copy of the file and not include the code in the backup copy? |
BeforeClose event - Savings
I'm sure the is an easier way, but I had the same problem
and came up with this solution. Copy each of the worksheets to a new workbook and then save that workbook as your backup. This will remove ALL of your code, so if you want to keep some, then you'll have to find another way. -----Original Message----- I want to save a copy of a spreadsheet in a different location, after I update it. I put code in the BeforeClose event, so it saves the file in the desired location. The problem I have is it saves the BeforeClose event also. Is there anyway to make a backup copy of the file and not include the code in the backup copy? . |
BeforeClose event - Savings
"Mike" wrote in message news:5o1cb.556043$YN5.374683@sccrnsc01... I want to save a copy of a spreadsheet in a different location, after I update it. I put code in the BeforeClose event, so it saves the file in the desired location. The problem I have is it saves the BeforeClose event also. Is there anyway to make a backup copy of the file and not include the code in the backup copy? You can probably work around this by reopening the backup copy after it has been saved, and then using sendkeys to activate the VBE and delete the code. Bit tricky though. |
All times are GMT +1. The time now is 10:52 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com