Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro closes excel and therefore won't run anymore


Firstly, I am a very new macro writer so please be patient!

I have written a very simple macro to save the current work sheet an
then quit excel if no other files are open:

Sub saveandquit()

ActiveWorkbook.Save
ActiveWorkbook.Close

If IsEmpty(ActiveWorkbook) = True Then
Application.Quit
Else
Application.WindowState = xlMinimized
End If

End Sub

The problem being that I can't (i.e. don't want to) store the macro i
my personal.xls file. If the macro is saved in the worksheet when th
macro shuts the worksheet, it effectively shuts itself and therefor
doesn't run the rest of the code.

Can I save the macro separately and then call it from a specifie
location or is there a better way to do what I am trying to do?

Thanks,

Davi

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro closes excel and therefore won't run anymore


Thanks for that.

That is a good way to work around the problem


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
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
Excel never closes Nader[_2_] Excel Discussion (Misc queries) 1 July 25th 07 04:30 PM
Excel closes down during a macro Muttley Excel Discussion (Misc queries) 0 January 24th 06 12:24 PM
Macro Editor closes Excel 2000 ? Rmontgo Excel Discussion (Misc queries) 0 July 16th 05 03:00 PM
Making a macro run when the user closes a workbook Nicke[_4_] Excel Programming 0 November 24th 03 02:54 PM
Making a macro run when the user closes a workbook Cesar Zapata[_2_] Excel Programming 0 November 24th 03 02:43 PM


All times are GMT +1. The time now is 02:03 AM.

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"