web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Is there an option to ...
Power Automate
Unanswered

Is there an option to close all active files and restart the flow if any error occurs?

(0) ShareShare
ReportReport
Posted on by 26

I have a flow that interacts with multiple excel files and a program thats semi-unstable. It will crash fairly regularly and need to be restarted. I've utilized the On Error tools on the hot spots where the issues occur the most often, but is there any way to do a blanket "If there are any errors, close everything and restart the flow" type option? An error can occur randomly and I have had trouble using the On Error option over large swaths of lines. 

  • VJR Profile Picture
    7,635 on at

    Hi @Shann 

    You can have something like this.

    Just a Pseudo code, you can make amendments as needed.

     

    VJR_2-1666324910932.png

     

    - All your regular flow steps will be between 2 to 5 within an On block error.

    - If any error occurs, go to the end of block (see below screenshot) ie; it will go to line #6.

    If no error, Flow will Stop at #4

    VJR_1-1666324715022.png

    - In line #6 complete all the closing of Excel activities and go to the start ie; MyLabel on line #1

     

    Idea is to make use of labels to navigate however you want.

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    To close all open excel files (without saving), you can also use Terminate process (or kill process, sorry, can’t remember what it is called) and terminate all Excel.exe. This will force close all excel without saving. Good luck!

  • Jamar_Forsythe Profile Picture
    Microsoft Employee on at

    Using the "New Rule" and creating a subflow that specifically handles this would be my recommendation, then you can capture the error in the subflow to keep track of when and where the issue occurs often:

     

    Main Subflow:

    Jamar_Forsythe_1-1666371829127.png

     

    "Close_Everything" Subflow:

    Jamar_Forsythe_3-1666372016209.png

    This subflow would capture the error produced by the On Block Error action, allowing you to maybe keep a list and see the common error it runs into over time. Be sure to set the Clear Error option so it only records the most recent error.

     

    Most importantly is structuring the On Block Error:

    Jamar_Forsythe_0-1666371537475.png

    It's configured to Go back to the beginning if it finds an error. But it will run the subflow first, once the subflow is complete it will return to the top of the block.

    You can wrap this action in some sort of Loop as well to have it run when an action doesn't find an error.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 229 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 223 Super User 2026 Season 2

#3
Valantis Profile Picture

Valantis 136 Super User 2026 Season 2

Last 30 days Overall leaderboard