View Full Version : onClose method in Excel macro
astharaj
07-21-04, 08:10 PM
Hi All,
I want to save the data when user closes the excel sheet/workbook. What should I do and how. Read the docs and it says to use Workbook_BeforeClose but this doesn't seem to be working. Where should I put this function?
Thanks,
Astha
Kelly again
07-26-04, 10:17 PM
Hi Ashta,
You are correct in asking where to put the Workbook_BeforeClose subroutine. Here are some brief instructions on how to do this. In my opinion, it is best to consider Workbook_BeforeClose as a suroutine that you cannot create yourself, but rather you must let Excel insert/create it for you, and then you can put whatever code you would like within the Sub.
Let me know if the following makes sense to you.
Download the following image and view it at full size, or try the link below.
http://members.dslextreme.com/users/kkj/vbax_special/steps.gif
Here is the link to view this picture at full resolution:
http://members.dslextreme.com/users/kkj/vbax_special/steps.html
If you can't view the picture by either method, then email me and I will send it to you. It appears that I cannot post an attachment into this forum.
Kelly again
07-26-04, 10:23 PM
Oh, I guess you can't email me thru the forum.
Send me a private message thru the forum if there are any issues. That should work. Of course, I will also check back into this thread
astharaj
07-27-04, 03:00 PM
Great - that worked. That was easy - I never looked at the Project Explorer - wierd.
Thanks you very much.
Astha
Kelly again
07-27-04, 06:04 PM
:) I'm so glad that it worked for you!
I love a happy ending. :cool:
Until next time,
Kelly (http://kellyjones.netfirms.com/visualbasic/search_in_folders.html)
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.