Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default 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
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
Running Total, Opening & Closing Acct Balance in Cash Book rushdhih Excel Worksheet Functions 1 February 2nd 10 05:31 PM
Auto running a macro on closing Jimmy D Excel Discussion (Misc queries) 6 November 22nd 07 01:58 AM
Excel still running in task manager after closing the application Willem Excel Discussion (Misc queries) 0 December 5th 06 01:56 PM
VBA Help - Running a macro when closing print preview carljonesuk[_2_] Excel Programming 3 February 9th 04 01:39 PM
Closing the Userform when macro is running SuperJas Excel Programming 5 December 10th 03 05:31 AM


All times are GMT +1. The time now is 12:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"