Vba code pop up

Hi All,

i was recording Macro code, while recording the code its not getting this below pop up

but while running the code in studio getting this pop up and it make me to do it manually then only that Invoke VBA activity is completed its automation.

so what i need to do, to click okay by VBA code.

Thank you

Hi @vineelag,

It seems like the excel application scope is being closed before excel refresh is complete. For now to confirm may be you can try giving a wait time in vba code

Application.OnTime Now + TimeValue(“00:00:05”), “DelayedProcedure”

or may be you can use visible property or keep excel open, so that you can see what is happening.

But this has never happened to me, normally the scope should be active till all actions are complete. If required you could add wait till refresh or whatever action is there in your code to complete using vba itself.

And in my experience it is always better to disable alerts or pop ups and use proper exception handling in vba.

1 Like

hi @Athira

As you said “it is always better to disable alerts or pop ups and use proper exception handling in vba”

where i can disable this ?

@vineelag

You can disable the pop ups using this

Application.DisplayAlerts = False

include this at the start of macro and at end for safety turn it to true again

Application.DisplayAlerts = True

Hope this helps

cheers

1 Like

Use this to disable alerts

Application.DisplayAlerts = False

and below one to enable at the end of macro

Application.DisplayAlerts = True

please refer to this link for error handling

also in your case i would suggest to first identify why that error is happening, if the refresh is not complete it would give wrong results right. As i mentioned to identify you can either add wait in vba or keep excel open/visible from UiPath

1 Like