Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default 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?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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?


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default 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.





Reply
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
Man Hour Savings Zul Excel Discussion (Misc queries) 1 August 26th 08 08:40 AM
beforeclose placement Curt Excel Discussion (Misc queries) 9 August 27th 07 08:00 PM
Trying to get annual savings dspencer Excel Discussion (Misc queries) 3 May 30th 07 09:59 AM
PASSWORD PROTECT BEFORECLOSE KandK Excel Discussion (Misc queries) 4 June 8th 06 09:34 AM
Excel - BeforeClose Problem... Al Mackay Excel Programming 0 September 22nd 03 12:26 PM


All times are GMT +1. The time now is 11:57 PM.

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"