Exit command button

  • what would you like to close?


    A form, your workbook, excel completely??


    When closing the thing, what would you like to happen??
    - closing a form
    - closing the workbook (should it be saved first, with what name etc.)

  • Whilst in xl hit Alt+F11. On the left hand side you should see the project explorer window (if not hit Ctrl+R). You should see your workbook listed as VBAProject (yourworkbook name) - right-click on it and choose insert module. Paste this code in:


    Code
    Sub CloseMe()
    'closes xl
        Application.Quit
    End Sub


    Go back to xl and insert a button from the forms toolbar and assign this macro to it


    HTH

    <a href="http://www.mrexcel.com/relayforlife.shtml" target="new"><img src="http://www.myimgs.com/data/vonpookie/anne_relay.gif"></a>

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!