Close Excel instances

Introduction

Paul, a former colleague, inquired if I knew of a tool capable of closing all Excel instances simultaneously. As part of his work with Microsoft Power BI, he often uses Excel to manipulate data. However, he’s encountered situations where Excel doesn’t fully close but remains hidden as a background process in Windows. Rather than delving into the intricacies of the Windows Task Manager, Paul seeks a straightforward solution to close all Excel instances.

Solution

After researching methods for closing Windows processes, I came across a helpful article on Stack Overflow. Armed with that information, I developed a small Windows Console application. During installation, a desktop shortcut for the app is conveniently added.

Prerequisites

  • Windows 10 operating system
  • OS Preferably a sandbox/virutal machine
  • All data will be lost for the Excel instances that are closed
  • Use this tool at your own risk!

Installation

Open this page and follow the instructions.

Example C# code used in this tool.
using System.Diagnostics;
static void CloseExcelInstances()
{
    Process[] processes = Process.GetProcessesByName("Excel");

    foreach (Process instance in processes)
    {
        instance.Kill();
        instance.WaitForExit();
    }
}