Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Apr 2015
    Posts
    155
    Thanks
    70
    Thanked 0 Times in 0 Posts

    Excel Processing After Being Closed-Shows up in Task Manager

    Hi Experts-

    Dr. Google doesn't have a solution, at least that I could find.

    Problem: After setting up the following code in ThisWorkBook:

    Private Sub Workbook_Open()Application.Visible = False
    UserForm1.Show
    End Sub

    When I close the form with a command button or using the Red X, Excel closes in Task Manger Apps, but continues to run in Background Process. Other than closing down the computer the only way I have found to close Excel is using End Task in the Task Manager.

    I've tried the following code in the form's close button without success.

    ThisWorkbook.Close savechanges:=False

    ThisWorkbook.Saved = True

    ActiveWorkbook.Close savechanges:=False

    Application.Workbooks("Quiz-demo sample-copy.xlsm").Close

    I'm using Windows 8

    Thank you for any help to solve this problem.

  2. #2
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,832
    Thanks
    136
    Thanked 484 Times in 461 Posts
    Hi

    When faced with a problem you should never quit.
    Except in this case.
    What you need to use is Application.Quit

    For example, you could add this to the Form code module:

    Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    Application.Quit
    End Sub

    zeddy

  3. The Following User Says Thank You to zeddy For This Useful Post:

    Excelnewbie (2016-03-25)

  4. #3
    2 Star Lounger
    Join Date
    Apr 2015
    Posts
    155
    Thanks
    70
    Thanked 0 Times in 0 Posts
    Zeddy,

    Thank you for answering my question. I appreciate your help.

    I also found the following code in case others run into the same problem.

    Private Sub CmdClose_Click()

    Dim w As Workbook

    For Each w In Application.Workbooks
    w.Save
    Next w
    Application.Quit

    End Sub

Posting Permissions

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