How to check if any excel file is open? Also file explorer

How to check if if a or more Excel files are open? Since my program deals with many Excel files, I want to warn the user before it starts the actual execution, saying “Please save all your Excel files and close them before execution” only if the program detects an open Excel file, or more than one Excel files, and I want to exit the program.

I know there is kill process activity, but I want to warn the user in advance.
How could I do this?

Also, I want to close any open File Explorer too. How to check if there is at least one opened File Explorer?

Edit: I seem to be able to find sources where you can check if a specific Excel file is open… but it requires the path to that file. That’s not my case. I want to close any opened Excel workbooks, whose paths I don’t even know…

Hello @tomato25
Check the image of the workflow below to get an idea


Get Processes Activity Gets the list of all running processes. and by using this activity we get collection of all running processes

2 Likes

In addition to the previous post, you can check if any file explorer or excel is open as below

if item.ToString.Contains("explorer") or item.ToString.Contains("EXCEL")
--- excel/file explorer open

1 Like

Thank you guys! It worked wonders!!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.