Results 1 to 12 of 12
  1. #1
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    Darmstadt, Hessen, Germany
    Posts
    128
    Thanks
    15
    Thanked 2 Times in 2 Posts

    How To Close 5 Instances Of Excel 2007 At Once...

    Hi All,

    i have 5 workbooks open at separate instances.

    Is it possible to to close all of them at the same time by the use of a macro?

    Thank you in advance for your help,

    Wolfgang

  2. #2
    4 Star Lounger SpywareDr's Avatar
    Join Date
    Dec 2009
    Location
    Riviera Beach, Maryland, USA
    Posts
    490
    Thanks
    10
    Thanked 52 Times in 43 Posts
    Click Start, type in:

    taskkill /f /im excel.exe /t

    and press [Enter].

  3. #3
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    Darmstadt, Hessen, Germany
    Posts
    128
    Thanks
    15
    Thanked 2 Times in 2 Posts
    Hi SpywareDr,

    thanks for your fast answer.

    Question: Will the contents of each workbook be save or not?

    If not do I have to make sure that everything is saved?

    Best,
    Wolfgang

  4. #4
    4 Star Lounger SpywareDr's Avatar
    Join Date
    Dec 2009
    Location
    Riviera Beach, Maryland, USA
    Posts
    490
    Thanks
    10
    Thanked 52 Times in 43 Posts
    You're welcome.

    No, the contents of each workbook will not be saved. The "/f" (force) parameter forces all instances of the excel.exe program to close immediately. If you remove the "/f", the Excel icon(s) on the Taskbar will start flashing. Click it and it will prompt you to save your changes (or not).

  5. #5
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    Darmstadt, Hessen, Germany
    Posts
    128
    Thanks
    15
    Thanked 2 Times in 2 Posts
    Another question, by "Start" do you refer to the Start button of Windows and have me input your parameters?

    I did that and Windows tells me that "taskkill" is not found...

  6. #6
    4 Star Lounger SpywareDr's Avatar
    Join Date
    Dec 2009
    Location
    Riviera Beach, Maryland, USA
    Posts
    490
    Thanks
    10
    Thanked 52 Times in 43 Posts
    1) Yes, by "Start" I mean the Microsoft Windows 7 orb, (the circle with the Microsoft Windows logo on it), that is usually seen at the left end of the Taskbar.

    2) It works fine here on two different Windows 7 setups, Ultimate and Professional, (both 64-bit), Windows XP Professional (32-bit) and Windows 8.1 Pro 32-bit. (Note that in Windows 8.x, you'll need to press [Winkey][R], type in your taskkill... command and then press [Enter]. You can also do the same in Windows 7 and XP).

    In your case, you might try adding your complete drive:\path location to your taskkill.exe program file. For example, if your taskkill.exe program is in the default location of "c:\windows\system32", the command would be

    c:\windows\system32\taskkill.exe /f /im excel.exe /t

    Also make sure you're using two "k"'s: taskkill
    Last edited by SpywareDr; 2013-11-06 at 13:35.

  7. #7
    Gold Lounger Maudibe's Avatar
    Join Date
    Aug 2010
    Location
    Pa, USA
    Posts
    2,637
    Thanks
    115
    Thanked 650 Times in 592 Posts
    Wolfgang,

    Depending if you wish to save changes or not, use the one of the following codes to close multiple Excel files simultaneously. Note: This can only be done if they are opened from the same instance of Excel.

    If you want to save:
    Code:
    Application.DisplayAlerts = True
    Application.Quit
    If you do not want to save:
    Code:
    Application.DisplayAlerts = False
    Application.Quit
    HTH,
    Maud

  8. #8
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    Darmstadt, Hessen, Germany
    Posts
    128
    Thanks
    15
    Thanked 2 Times in 2 Posts
    I run XP Home US-Vesion and it does not contain "TASKKILL.EXE".

    I did a thorough search on my C: Drive and did not find it.

    Wolfgang

  9. #9
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    Darmstadt, Hessen, Germany
    Posts
    128
    Thanks
    15
    Thanked 2 Times in 2 Posts
    Hi Maud,

    thank you for your answer but I do need those files to be opened in separate instances.

    Best,
    Wolfgang

  10. #10
    4 Star Lounger SpywareDr's Avatar
    Join Date
    Dec 2009
    Location
    Riviera Beach, Maryland, USA
    Posts
    490
    Thanks
    10
    Thanked 52 Times in 43 Posts
    Try this:

    1. Download PrcView (Process Viewer) v3.6.2.1 by Igor Nys.

    2. Extract the enclosed "pv.exe" file to your "C:\Windows" folder.

    3. Click Start > Run, type in pv -f -k excel.exe and press [Enter].

  11. The Following User Says Thank You to SpywareDr For This Useful Post:

    wolfgang (2013-11-07)

  12. #11
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    Darmstadt, Hessen, Germany
    Posts
    128
    Thanks
    15
    Thanked 2 Times in 2 Posts
    HI,

    I tried your advise and it runs just fine except for the fact that it shuts-down all Excel instances without giving me the chance of saving.

    I went thru the internet and found a macro at VBAX which terminates any .exe file with the option to cancel and save my work.

    Then I run it again and all instances will terminate.

    Again, thank you very much for your time and help!

    Best Regards,

    Wolfgang

  13. #12
    4 Star Lounger SpywareDr's Avatar
    Join Date
    Dec 2009
    Location
    Riviera Beach, Maryland, USA
    Posts
    490
    Thanks
    10
    Thanked 52 Times in 43 Posts
    You're welcome. Good to hear you found a solution. Thanks for letting us know.

Posting Permissions

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