Consulting

Results 1 to 5 of 5

Thread: Exit Excel Macro

  1. #1
    VBAX Newbie
    Joined
    Oct 2006
    Posts
    3
    Location

    Exit Excel Macro

    Hi,

    I am trying to find a macro that will allow me to exit Excel and prompt to save the current workbook and then exit Excel. I want to also assign this to a button.

    Thanks

    Simon.

  2. #2
    VBAX Mentor jammer6_9's Avatar
    Joined
    Apr 2007
    Location
    Saudi Arabia
    Posts
    318
    Location
    Make a commandbutton and if symptomps persist ask the VBAX expert,

    [vba]Private Sub CommandButton1_Click()
    activeworkbook.close(Yes)
    application.quit

    End sub
    [/vba]

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Jammer
    Our code posting is a little different from other sites. Select your code and click the VBA button to format it as shown.
    Regards
    MD
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    VBAX Mentor jammer6_9's Avatar
    Joined
    Apr 2007
    Location
    Saudi Arabia
    Posts
    318
    Location


    Quote Originally Posted by mdmackillop
    Hi Jammer
    Our code posting is a little different from other sites. Select your code and click the VBA button to format it as shown.
    Regards
    MD

  5. #5
    Moderator VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    Hi Simon,

    Just curious - isn't it quicker just to use the "X" in the top right corner of the Excel window? By default, if you have not saved any open workbook it will prompt you to save, then exit the application.

Posting Permissions

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