|
Subject:
|
Code to execute before application (excel) quits
|
|
Posted By:
|
ksksasi
|
Post Date:
|
5/1/2008 2:25:12 PM
|
Hi, Would like to know if there is anyway to execute a piece of code before the application exits.
To be more specific, am looking for executing before application exits and not before workbook close.
Thanks.
|
|
Reply By:
|
allenm
|
Reply Date:
|
5/6/2008 2:35:51 PM
|
The macro language for Excel is meant to work on workbooks and are a part of that workbook project in the VBA editor. The way to handle this is to have the code execute from the Personal.xls hidden book that contains your macros for all workbooks.
There is a hidden workbook that stores your local macros. The before workbook close for this project should only fire when Excel itself is closed. Putting your code for before workbook close in this project should accomplish what you want since Personal.xls normally always opens when you open Excel and only closes when Excel is closed.
Hope this helps.
|
|
Reply By:
|
ksksasi
|
Reply Date:
|
5/7/2008 8:10:03 AM
|
Thanks Allen.
I suppose adding code to the Personal.xls will really help but I don't see that Excel workbook on the VBA Editor's Project Explorer. How do I view it so that I can place my code under appropriate event.
|
|
Reply By:
|
Shasur
|
Reply Date:
|
5/7/2008 9:45:57 PM
|
Hi
The PErsonal.xls will be available in c:\Documents and Settings\Your UserName\Application Data\Microsoft\Excel\xlstart The Excel workbook in XLStart folder will be opened by Excel when an instance is created.
If there is no Excel there, you can create a new workbook and save it in this folder
Cheers Shasur
http://www.dotnetdud.blogspot.com
VBA Tips & Tricks (http://www.vbadud.blogspot.com)
|