Auto-Close Workbook&Application

ToddMc

New Member
Joined
Mar 3, 2002
Messages
3
XL2000user:
I would to use a macro to close its workbook and then shut down XL.
The script below is what I was trying. Each statement runs by itself, but together the macro stops after the worksheet closes. The ap does not shut down.
???

Todd
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Don't try and close the workbook first, use a statement to save it if necessary and then just use: -

Application.Quit
 
Upvote 0
On 2002-03-04 12:06, ToddMc wrote:
XL2000user:
I would to use a macro to close its workbook and then shut down XL.
The script below is what I was trying. Each statement runs by itself, but together the macro stops after the worksheet closes. The ap does not shut down.
???

Todd

Could you post the code?

but, you might try putting the:

Application.Quit

in the Workbook_BeforeClose i.e:

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Application.Quit

End Sub


Any help?
 
Upvote 0
This is the script I was supposed to attach

Private Sub Workbook_Open()
Call Import '(macro name)
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.Quit
End Sub
 
Upvote 0
Private Sub Workbook_BeforeClose(Cancel As Boolean)

Application.Quit

End Sub

works for me??
 
Upvote 0
On 2002-03-04 12:49, Ian Mac wrote:
Private Sub Workbook_BeforeClose(Cancel As Boolean)

Application.Quit

End Sub

works for me??
This works but the SaveChanges=False doesn't seem to work. Any suggestions?



Private Sub Workbook_Open()
Call Import
Me.Close SaveChanges = False
Application.Quit
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.Quit
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,371
Messages
6,171,689
Members
452,418
Latest member
kennettz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top