cancel
Showing results for 
Search instead for 
Did you mean: 

Excel - Run Macro (Threaded)

IanClowery
Level 4
Hi, Has anyone had any luck getting the "Run Macro with Parallel Thread" code snippet provided by BP in the VBOs section, plugged into their MS Excel VBO? It calls a function that isn't included in the base MS Excel VBO (WaitForConfirmationDialog), and there's no global code included with the XML.
25 REPLIES 25

This appears to be an error raised by the macro code (VBA). I'd take a look at the macro and see if you can figure out why it's reporting that the filename or number are incorrect. That would stop you from getting the error.

If that doesn't work, you'd need to try revising the fuction WaitForConfirmationDialog in the Global Code of the VBO as I mentioned in the note above such that it looks for a dialog with title Erreur n* 52

Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

I had a similar issue once - Blue Prism VBO run macro action led to a pop up,  Blue Prism was trapped in it's thread until the pop up was ok'd but because it was a trapped robot there was no way to click the button except manually...  

I was pushed for time because it was a POC with a looming deadline so rather than spend time figuring out how to get the parellel thread stuff working I just Showed the Excel and clicked ran the macro from within excel using global actions - so the pop up occurred but Blue Prism was not trapped waiting and I was able to click it using the standard windows interface.

Not ideal but sometimes just getting an automation working whatever the means is the only option.

------------------------------
Denis Dennehy
Head of Professional Services, EMEA
Blue Prism Ltd
Europe/London
------------------------------

Thanks Jorge for sharing the VBO, this indeed quite helpful.

------------------------------
MuraliKrishna
RPA Consultant
------------------------------

Hi Eric,

I have a excel spreadsheet with three different macros. At the end of each run, the macro displays a msgbox saying whether the run is successful or not.  I am using BP 6.6. version and using the Run macro VBO  action to run the macros.
I have spied the msgbox popup separately and handled the popup within the same MS Excel utility. 
But once the run is completed, the msgbox  gets displayed and its not handled. Each time I am manually handling the pop up. How do I modify the code to handle the msgbox within Blue Prism. 
Also I  don't see any attachment in the previous reply.

------------------------------
Janu RPA Developer
------------------------------

@Janu,

The Run Macro with Parallel Thread action is only available in the MS Excel​ VBO - Extended which you can find at the link below.

https://digitalexchange.blueprism.com/dx/entry/9648/solution/ms-excel-vbo---extended

We'll look at incorporating it into the mainline Excel VBO.

Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hello Eric,

Thanks for the reply. 

I tried with the extended version of MS Excel VBO and still I see the pop up and  I have to handle it  manually. 

Please find the screenshot below

------------------------------
Janu RPA Developer
------------------------------

Hey Eric, 

Please ignore the previous reply. 
I used the Ms excel extended version - Run macro Parallell thread VBO to run, I just gave a approx. timeout as 60 sec, but I couldn't see whether the macro  has run successfully or not.  More over if i give 60 sec as timeout,but what happens if macro is taking more than 60sec to complete the run?

Thanks in advance

------------------------------
Janu RPA Developer
------------------------------

@Janu,

The action Run Macro with Parallel Thread has an input value called Timeout. Are you specifying a value? If so, what are you using as the timeout value?​ If you don't enter anything I believe it defaults to waiting 20 seconds for the macro to complete. The important part here is that you need to set that timeout to greater value than the estimated time it will take for the macro to finish. 

In other words, if the macro usually takes 30 seconds to complete you should set the timeout to say 35 seconds or more. The reason for that is the parallel thread that looks for a pop-up is bound to the timeout. It either finds a pop-up and closes it, or the function times out and exits. This is necessary so BP isn't continually blocked.

Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Thanks Eric, it works!! My macro takes 65 secs to end, and  I gave a timeout greater than 65 and I see BP handles the popup. 
Great thanks again for the prompt reply,


------------------------------
Janu RPA Developer
------------------------------

The Parellel Thread action may have worked - the pop up is not related to that.

The pop up is actually part of the macro that has been set off running (in a parellel thread).  There is nothing in our Excel interface that will allow you to interface with a Win32 window.

What you need to do next is create a seperate win32 object called something like "Excel Win32 Interface" with actions to attach to the Excel process read the message and click the ok button on the message box the macro within the Excel document has shown.

The other option is to change the macro code itself so the pop up does not occur - my experience of a similar project was I was not allowed to change the macro code for the robot,  i was told I had to automate the process as-is,  so this latter option may not be something you are able to do.

------------------------------
Denis Dennehy
Head of Professional Services, EMEA
Blue Prism Ltd
Europe/London
------------------------------