Close Excel from a VBA program

  • Thread starter Thread starter Leif Rasmussen
  • Start date Start date
L

Leif Rasmussen

Hi
How do I close Excel from a VBA modul ?
The help in VBA say Applicaion.Quit but that do not
function !

Kind regards
Leif
 
Leif,

Application.Quit
should work.

Sub TestMe()
Application.DisplayAlerts = False
Application.Quit
End Sub

John
 
Works for me!
NB: With alerts turned off, it quite happily quits without saving changes to
the worksheet.
 
Hej
The TestMe() do function.
The only difference for me is that I pricipally have 1
main program and is calling 2 functions. I have put
the "application.quit" into the mainprogram, and still it
will not function. Please advise if possible.

Kind regards
Leif
 
I was amused to find that you can put application.quit into the
workbook_open() procedure, and thus produce a spreadsheet that closes itself
down as soon as you open it.

It is interesting how many different ways there are to shoot yourself in the
foot.

In case anyone tries this with a workbook that contains some useful info
they want, I also worked out that you can in fact open the spreadsheet by
first enabling virus protection on the tools .... options menu.

Geoff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top