Forum Discussion
andrewa
9 years agoContributor
If you don't really care about interacting with the window, our automation suite has the following snippet of code that shuts down Excel completely. I have it in a script file and call it when I want to close down Excel.
function CloseExcel()
{
p = Sys.FindChild("ProcessName", "EXCEL*");
Log.Message('Starting Excel close process');
while (p.exists)
{
p.Close();
//Wait until the process is closed.
isClosed = p.WaitProperty("Exists", false);
//If closing failed, terminate the process.
if (isClosed == false)
{
Log.Message('isClosed is still false');
p.Terminate();
}
p = Sys.FindChild("ProcessName", "EXCEL");
}
Log.Message('Excel close process successfully terminated');
}
- cristina889 years agoOccasional Contributor
Thank you andrewa!!