PC Review


Reply
Thread Tools Rate Thread

How to code macro to close Excel Application?

 
 
Eric
Guest
Posts: n/a
 
      7th Jan 2010
Does anyone have any suggestions how to code macro to close Excel Application?
I have a macro coding, and would like to add code to close Excel Application
at the end of macro.
Does anyone have any suggestions?
Thanks in advance for any suggestions
Eric
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      7th Jan 2010
Hi Eric

Try

Application.DisplayAlerts = False
Application.Quit

--
Jacob


"Eric" wrote:

> Does anyone have any suggestions how to code macro to close Excel Application?
> I have a macro coding, and would like to add code to close Excel Application
> at the end of macro.
> Does anyone have any suggestions?
> Thanks in advance for any suggestions
> Eric

 
Reply With Quote
 
Benito Merino
Guest
Posts: n/a
 
      7th Jan 2010
On 7 ene, 11:33, Eric <E...@discussions.microsoft.com> wrote:
> Does anyone have any suggestions how to code macro to close Excel Application?
> I have a macro coding, and would like to add code to close Excel Application
> at the end of macro.
> Does anyone have any suggestions?
> Thanks in advance for any suggestions
> Eric


Hi Eric.

One way is application.quit

Regards,


Benito
Barcelona
 
Reply With Quote
 
Eric
Guest
Posts: n/a
 
      8th Jan 2010
Thank everyone very much for suggestions
If I close Excel application, will it save this file first before closing?
Does anyone have any suggestions how to edit the code to save the file first
before closing the application?
Thank everyone very much for any suggestions
Eric

"Jacob Skaria" wrote:

> Hi Eric
>
> Try
>
> Application.DisplayAlerts = False
> Application.Quit
>
> --
> Jacob
>
>
> "Eric" wrote:
>
> > Does anyone have any suggestions how to code macro to close Excel Application?
> > I have a macro coding, and would like to add code to close Excel Application
> > at the end of macro.
> > Does anyone have any suggestions?
> > Thanks in advance for any suggestions
> > Eric

 
Reply With Quote
 
Benito Merino
Guest
Posts: n/a
 
      8th Jan 2010
On 8 ene, 06:09, Eric <E...@discussions.microsoft.com> wrote:
> Thank everyone very much for suggestions
> If I close Excel application, will it save this file first before closing?
> Does anyone have any suggestions how to edit the code to save the file first
> before closing the application?
> Thank everyone very much for any suggestions
> Eric
>
> "Jacob Skaria" wrote:
> > Hi Eric

>
> > Try

>
> > Application.DisplayAlerts = False
> > Application.Quit

>
> > --
> > Jacob

>
> > "Eric" wrote:

>
> > > Does anyone have any suggestions how to code macro to close Excel Application?
> > > I have a macro coding, and would like to add code to close Excel Application
> > > at the end of macro.
> > > Does anyone have any suggestions?
> > > Thanks in advance for any suggestions
> > > Eric


Hi.

If you want to save all the workbooks opened:

Sub quit()
For Each ws In Workbooks
a = ws.Name
ws.Save
Next
Application.quit
End Sub

If you want to save only the active workbook:

Sub quit()
ActiveWorkbook.Save
Application.quit
End Sub

Regards,

Benito
Barcelona
Spain

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run code on application close DZ Microsoft Access VBA Modules 1 11th Nov 2008 07:14 PM
RE: Run code on application close? =?Utf-8?B?U2hlcnJ5Vw==?= Microsoft Access Macros 1 4th Jan 2007 07:52 AM
Need Macro To Close Excel Application =?Utf-8?B?TWFyeVN1ZQ==?= Microsoft Excel Programming 3 5th Jan 2005 07:24 PM
macro to close excel application other than application.quit mary Microsoft Excel Programming 1 14th Sep 2004 03:43 PM
How do I close Excel Application from PPT code module ? Dan Microsoft Powerpoint 1 24th Jun 2004 01:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:13 AM.