weird saving of a document with macros resulting with macros being transfered to the copy  
Author Message
pegdc





PostPosted: Top

Excel Programming >> weird saving of a document with macros resulting with macros being transfered to the copy

Hi everybody

I have happened to come accross a knotty problem while saving a workbook
with this the workbook object's SaveAs method.
What I did was to prepare an xls workbook (called Tender.xls ) to open and
access different dbf files to retrieve some data on which to manipulate
within the workbook later.
This is all done through macros called up by a user when they press a menu
button on a toolbar assigned to this document.

All had been going just flawlessly until I hit an idea that it would be
prudent to provide this document with the automatic backup saving
capability: just imagine the user closes the document and the workbook as
it is of each time the data are accessed is written with the time and date.

So I have placed a macro to save a copy of my Tender.xls document with its
name expanded with the current date and time such as "Tender 2005-12-10 time
20-20 .xls". The macro code is called / placed within the
Workbook_BeforeClose event within the Tender.xls workbook.

The trouble all starts when I open the original document later to continue
these data retrieving operations. Now, when I press the buttons assigned to
my macros the macros from within that saved backup copy of let's say "Tender
2005-12-10 time 20-20 .xls" are called and the "Tender 2005-12-10 time 20-20
.xls" is opened instead of the macros from the original "Tender.xls "
workbook.


Is there a way to Save this backup copies and then save the main document so
that macros associations on my tool bar in the main document are preserved
(linking to macros within that document and not to its copies)
?
Gonzales

Excel33