+ Reply to Thread
Results 1 to 3 of 3

Userform + close button

  1. #1
    Chip Smith
    Guest

    Userform + close button

    i have a user form and when you click the "Close" button at the bottom it
    closes out of the macro/userform it looks like this right now..

    Private Sub cmdClose2_Click()
    Unload Me
    End Sub

    what can i add to this sub so that when the button is clicked it

    1. saves the workbook
    2. closes the worksheet/exit out of excel

    thanks!

    --
    --Chip Smith--


  2. #2
    Kevin B
    Guest

    RE: Userform + close button


    Just add the following to your code:

    Unload Me
    ActiveWorkbook.Save
    Application.Quit

    --
    Kevin Backmann


    "Chip Smith" wrote:

    > i have a user form and when you click the "Close" button at the bottom it
    > closes out of the macro/userform it looks like this right now..
    >
    > Private Sub cmdClose2_Click()
    > Unload Me
    > End Sub
    >
    > what can i add to this sub so that when the button is clicked it
    >
    > 1. saves the workbook
    > 2. closes the worksheet/exit out of excel
    >
    > thanks!
    >
    > --
    > --Chip Smith--
    >


  3. #3
    Harald Staff
    Guest

    Re: Userform + close button

    Hi Chip

    What happens if the user has more than your file open in Excel ? Don't do
    that.

    Best wishes Harald

    "Chip Smith" <ChipSmith@discussions.microsoft.com> skrev i melding
    news:99F84912-8FC1-446B-B0FA-C456E319EDA6@microsoft.com...
    > i have a user form and when you click the "Close" button at the bottom it
    > closes out of the macro/userform it looks like this right now..
    >
    > Private Sub cmdClose2_Click()
    > Unload Me
    > End Sub
    >
    > what can i add to this sub so that when the button is clicked it
    >
    > 1. saves the workbook
    > 2. closes the worksheet/exit out of excel
    >
    > thanks!
    >
    > --
    > --Chip Smith--
    >




+ 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