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

Notifications

Announcements

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!

I have the same question (0)
  • 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!

  • 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard