Closing Excel from VBA

  • Thread starter Thread starter Jimmy
  • Start date Start date
J

Jimmy

Hello,

Have a macro that emails out certaing information and
would like to closed or Exit Excel once code is executed.
Right now I have a Mssage box that let's the user know it
finished emailing the information but it advises the user
to please close excel.

Only one excel spreasheet opened and tried the
Application.Quit but that does not closes Excel.

Any ideas?

Thanks in advance!
Jimmy
 
Hi
normally
application.quit
should work. what is the code you have tried (have you eventually tried
to close the workbook prior to this statement?)
 
Do you close your workbook before you call quit?

.. . .
thisworkbook.Close
Application.Quit
End Sub

if so, the code stops executing when the workbook is closed, so it never
gets the quit. If you remove the close command, then application.quit will
be executed and this will take care of closing your workbook.
 
Tried and it did not work.... Now I close the form,
maximize the workbook, then used
thisworkbook.Close
Application.Quit

Still not closing.. Could it be due to the Form??

Thanks in advance!
Jimmy
 
I thought I advised to remove the Thisworkbook.close from the code.


I can't say if the form is interfering. Does the workbook close? If so,
then I would say the form isn't the reason - the reason is because you close
the workbook and code execution stops before reaching the quit command.
 
Was using this code before I modified it to
thisworkbook.Close.

frmTestimonials.Hide
Application.ActiveWorkbook.Close False), "Testimonials.xls"
Application.ActiveWindow.Close (False), "Testimonials.xls"
Application.Quit


Any other suggestions??


Thanks!
Jimmy
 
Thanks!

That worked.. removed the thisworkbook.Close before the
App.Quit

Thanks Tom!
 

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