Results 1 to 5 of 5
  1. #1
    2 Star Lounger AlanWade's Avatar
    Join Date
    Dec 2009
    Location
    Sweden
    Posts
    109
    Thanks
    12
    Thanked 3 Times in 3 Posts

    Button to Close Workbook

    As the title says I am trying, without any success, to create a button to save the workbook then close it. I know how to create a button but cannot figure the rest of it out.

    Any idea's?

    Thanks in advance
    Alan

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts
    Create a macro like this:
    Code:
    Sub SaveAndClose()
    ThisWorkbook.Close (True)
    End Sub
    Right-click the button and press "Assign Macro", then select the above code.

    Steve

  3. #3
    2 Star Lounger AlanWade's Avatar
    Join Date
    Dec 2009
    Location
    Sweden
    Posts
    109
    Thanks
    12
    Thanked 3 Times in 3 Posts
    Thanks for the quick help Steve. I didnt write it down properly, what I want it to do is close Excel completely and not just the workbook. Sorry for not writing it out correctly

    Alan

  4. #4
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts
    Code:
    ThisWorkbook.Save
    Application.Quit
    Steve

  5. The Following User Says Thank You to sdckapr For This Useful Post:

    AlanWade (2014-05-06)

  6. #5
    2 Star Lounger AlanWade's Avatar
    Join Date
    Dec 2009
    Location
    Sweden
    Posts
    109
    Thanks
    12
    Thanked 3 Times in 3 Posts
    Thanks Steve! I had been struggling with this for a couple hours.

Posting Permissions

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