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

Hi Denis,

Thanks. I actually created a different Business object to handle the macro popup using Win32 mode, but it doesn't work.  I spied each msgbox  and created actions too, but somehow it didn't work for me. Can you please share the screenshot which you tried.

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

It is years ago since I had to do this.  If memory serves global mouse clicks were required,  have you done the usual of trying different types of of interfaces and click events when one does not work?  Good luck!

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

Hi Denis, 

I am still facing problem with this one, I am running macros using "Run macros with Parallel thread" and this actually blocks certain popups but not all. My excel spreadsheet has a macro which access different SharePoint /hyperlinks to update the sheet. When the macro runs usually we get the popup(See screenshot1) and we select as don't update and continue. To ignore this alert I just turned off the display alerts = False in my macro code and also to ignore these popups we turned off the alerts under the Data tab>Edit Links>Startup prompt>Don't display and don't update the links. After doing these, when I run macro manually all these popups are ignored and Its automatically handled. But when I run the macro from Blue prism studio I get a pop saying "Cannot download the information"(See screenshot2).
Can someone please advise on this. 

Thanks in advance

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

Hello.  My solution was not related to the 'Run Macros' action.  If I was using a Run Macro action I would replace the pop up messages in the Excel with macros that I run via Excel macro actions.
The alternative option I said I had used in the past (because of time constraints and complexity of someone elses macro code) was to simply handle the Excel pop ups in a seperate thread.  To do this I basically kicked off a Blue Prism background process from within my own object that waited for the pop up and handled it using Win32 code.   This is a similar trick I have used in the past with model pop up dialogs in Java applications (there might be mention of that in the Blue Prism Java guide on the portal).

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

Hi Eric,

I've had this hanging popup interrupting my process for over a year now, what you mention is changing it to look for dialogs that have "Microsoft VIsual Basic" in title bar is just what I need. But how can I edit the code to also wait for this title and how would I make it close the window?

This is the standard code

Timeout = Timeout_Period
Dim ThreadDialogBox As New System.Threading.Thread(AddressOf WaitForConfirmationDialog)
ThreadDialogBox.Start()



------------------------------
Atli Harðarson
------------------------------

Hello @Atli Harðarson,

In the code that you posted do you see the reference to WaitForConfirmationDialog?​ That's the name of a function defined in the Global Code section of the VBO. To access the Global Code, you need to go to the Initialise tab and double click on the information stage:

14166.png
Then, in the Business Object Properties dialog, you want to click on the Global Code tab.

14167.png
After that, scroll down to the WaitForConfirmationDialog method definition which should be around line 678'ish. That's where you can configure the window title.

14168.png
The code is already designed to run in a loop on a separate thread looking for any pop-ups.

Cheers,​

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