Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro Upon Closing
I have figured out the code to run Excel in Full Screen mode and get it to
have a "non excel" look to it. I want to run the reverse code however upon closing excel. What code should I use to get a macro to run as I close the program down. Private Sub Workbook_Close() ??? Private Sub Auto_Close() ??? Or somethine entirely different. Thanks! Chris |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro Upon Closing
Auto Close is a little older that workbook close but they both function
exactly the same. The advantage to auto close is that you can place it in a modue and export it for later use. But either way is just fine... HTH "Confused Excel Fan" wrote: I have figured out the code to run Excel in Full Screen mode and get it to have a "non excel" look to it. I want to run the reverse code however upon closing excel. What code should I use to get a macro to run as I close the program down. Private Sub Workbook_Close() ??? Private Sub Auto_Close() ??? Or somethine entirely different. Thanks! Chris |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro Upon Closing
Hi Chris
Adding: You should imo use the parallell to what you use on opening, for the sake of symmetry and consistence. But test what happens if you're prompted "save changes ?" and you select Cancel. The file stays open but the macro has already done its job. So you must have your code deal with this before it does its real job. HTH. Best wishes Harald "Confused Excel Fan" <Confused Excel skrev i melding ... I have figured out the code to run Excel in Full Screen mode and get it to have a "non excel" look to it. I want to run the reverse code however upon closing excel. What code should I use to get a macro to run as I close the program down. Private Sub Workbook_Close() ??? Private Sub Auto_Close() ??? Or somethine entirely different. Thanks! Chris |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro Upon Closing
I guess my basic problem is that I can't figure out how to get a macro to
automatically run as I close down excel. I figured out how to have some code run at the opening, and I want all of it to be reversed as I shut it down...So, I want all the changes I made to be undone as I close the program. Im just now sure what kind of code, or where to put the code in the first place. For some reason, the way excel is set up at my work, If I was just to run the code that puts it into full screen mode, and gets rid of all menus...even if I close excel it and don't save any changes, the code seems to be applie to any other excel worksheet I open. This is the reson I want to reverse the code everytime this particular excel sheet closes down. Thanks for the replies so far! Chris |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro Upon Closing
Try the following of some thing like it
In ThisWorkbook module: Private Sub Workbook_Open() Application.DisplayFullScreen=True ' Other formatting code End sub Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.DisplayFullScreen=False 'Code to reverse other formatting End Sub "Still confused Excel Fan..." wrote: I guess my basic problem is that I can't figure out how to get a macro to automatically run as I close down excel. I figured out how to have some code run at the opening, and I want all of it to be reversed as I shut it down...So, I want all the changes I made to be undone as I close the program. Im just now sure what kind of code, or where to put the code in the first place. For some reason, the way excel is set up at my work, If I was just to run the code that puts it into full screen mode, and gets rid of all menus...even if I close excel it and don't save any changes, the code seems to be applie to any other excel worksheet I open. This is the reson I want to reverse the code everytime this particular excel sheet closes down. Thanks for the replies so far! Chris |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro Upon Closing
Hi Chris
Apolgogies for this: It's like "I know how to make a left turn with my car, but I can't figure our how to make a right turn" -no harm intended. Here's some useful theory: http://www.cpearson.com/excel/events.htm note that there's a big difference between opening/closing Excel and opening/closing your spesific file. For Excel herself see http://www.cpearson.com/excel/AppEvent.htm Sounds like you're making a "dictator app" for Excel. Consider carefully what will happen if the user wants to work with several Excel files simoultaneously, that is very common. Maybe your changes should happen when you activate/deactivate your file, not on open/close. HTH. Best wishes Harald "Still confused Excel Fan..." <Still confused Excel skrev i melding ... I guess my basic problem is that I can't figure out how to get a macro to automatically run as I close down excel. I figured out how to have some code run at the opening, and I want all of it to be reversed as I shut it down |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Running Total, Opening & Closing Acct Balance in Cash Book | Excel Worksheet Functions | |||
Auto running a macro on closing | Excel Discussion (Misc queries) | |||
Excel still running in task manager after closing the application | Excel Discussion (Misc queries) | |||
VBA Help - Running a macro when closing print preview | Excel Programming | |||
Closing the Userform when macro is running | Excel Programming |