+ Reply to Thread
Results 1 to 4 of 4

Can you close excel once code is finished?

  1. #1
    Registered User
    Join Date
    03-02-2004
    Posts
    15

    Question Can you close excel once code is finished?

    Hi

    I am using Excel 2000 vba to create a userform that will get some info and save it to the workbook, once it has finished is there a way to get the actual excel application to close not just the workbook, but still automatically save changes?

    i.e.
    Workbooks("Name.xls").Close (True)
    but for the application not workbook.

    Thanks
    Jennie

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Jennie,

    Add Application.Quit below the save workbook statement.

    Example:
    Workbooks("Name.xls").Close (True)
    Application.Quit


    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    03-02-2004
    Posts
    15
    Thanks for the info:

    I couldn't get this to work straight away, but I put application.quit in the workbook_deactivate event and it worked then, was it not working before because the workbook was closing before it got to the application.quit command?

    Thanks for the help
    Jennie

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Jennie,

    Glad you caught that. Sorry about the oversight. I meant to include where the code should be placed. Yes, you are correct about why it didn't run this first time.

    Thanks,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1