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 / Set active Excel Works...
Power Automate
Unanswered

Set active Excel Worksheet activity bug

(0) ShareShare
ReportReport
Posted on by 15

Hello,

 

I found a bug for the "Activate Excel Worksheet" activity, which happens when the sheet that you are going to activate has underlying VBA code when it is actiavated and that code fails (VBA Error message box is displayed). When this occurs, the activity keeps going indefinitely because currently, there is no way to set a timeout for this activity.

 

I don't know where to report this bug or where to suggest to add a timeout property to these kind of excel activities.

 

Thanks!

VBA_Error_Example.PNG
  • WillSG Profile Picture
    352 Moderator on at

    Hi @JuanPuelloUSGBC  I hope you are doing well.

     

    Yes, there is a bug but in the macro code, not PAD, PAD is waiting for the macro to complete, but due to the unknown Macro error, PAD cannot continue.

     

    Follow this to overcome this issue:

     

     

    Sub YourMacroName()

     

    Application.ScreenUpdating = False

    Application.EnableEvents = False

    Application.DisplayAlerts = False

     

    [YOUR MACRO CODE GOES HERE]

     

    Application.ScreenUpdating = True

    Application.EnableEvents = True

    Application.DisplayAlerts = True

     

    End Sub

     

    By disabling the Application.EnableEvents and the Application.DisplayAlerts the macro will continue, the bug into the Macro will continue, but if you don’t get the desired output is because of that, so will have to check the Macro code.

     

    Please let me know if it works, happy automation!,


    If I have addressed your inquiry successfully, kindly consider marking my response as the preferred solution. If you found my assistance helpful, a 'Thumbs Up' would be greatly appreciated.

     

    Additionally, I offer specialized consultancy and development services leveraging PAD. If you're interested in exploring these services further, feel free to DM me, and we can initiate a discussion.

     

    Kind regards,

     

    Will SG

    Managing Director & Automation Lead

    RAMS CR (Recruitment & Automation)

    LinkedIn Profile

  • JuanPuelloUSGBC Profile Picture
    15 on at

    @WillSG Thanks for the answer.

     

    Unfortunately, I can not modify the Macro because the excel file is an external file for the automation. I think that the best approach for these scenarios where we can not control if the Macros inside a file are good or not is to add a timeout property.

     

    On the other hand, I came up with a workaround which is to activate the sheet using UI activities instead of the Excel one. This way I can control if the VBA error message appears (I attached an example)

     

    Thanks!

    Workaround.PNG
  • WillSG Profile Picture
    352 Moderator on at

    Hi @JuanPuelloUSGBC  I hope you are doing well.

     

    Great Job, of course if you can not access the Macro itself, that would be a problem.

     

    Nice workaround, my recommendation after the If action is to notify you or the user before closing the VBA Bug window, in that way you will now that there was an error in the macro.

     

    Happy automation!,


    If I have addressed your inquiry successfully, kindly consider marking my response as the preferred solution. If you found my assistance helpful, a 'Thumbs Up' would be greatly appreciated.

     

    Additionally, I offer specialized consultancy and development services leveraging PAD. If you're interested in exploring these services further, feel free to DM me, and we can initiate a discussion.

     

    Kind regards,

     

    Will SG

    Managing Director & Automation Lead

    RAMS CR (Recruitment & Automation)

    LinkedIn Profile

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 245 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 233 Super User 2026 Season 2

#3
Valantis Profile Picture

Valantis 136 Super User 2026 Season 2

Last 30 days Overall leaderboard