cancel
Showing results for 
Search instead for 
Did you mean: 

How launch macro VBA from BluePrism ?

kevin_guillemie
Level 3
Hello, I need to automate some actions in Excel as : - Change data source of a pivot table - Launch "Calculate Sheet" - Extends formula - Change filter data - Rename Worksheet By delay worries and lack of experiences on blueprism, can you tell me how can i do to launch a macro VBA from BluePrism ? if you know a quick way to implement these functions, can you tell me ? Thank you, With regards
11 REPLIES 11

jgreaves2
Level 4
Hi, I would suggest that you create your own code page within the MSExcel VBO supplied by Blue Prism. If you use the following code: authorised by Blue Prism:- GetInstance(Handle).Run(Macro_Name) Ensure you have the following inputs: -Handle -Macro Name Once created simply call it from a process like any other Business Object actions. This should run any macro built. Let me know how you get on. Thanks, James

kevin_guillemie
Level 3
Thanks for your replies. Indeed, i have macro blocking issue in Excel. I thought to add a delay of 15 sec with a timer which permits user to Allow Macro but i haven't real parameter to put ""in my wait"". Have you got an idea ? Can i just tell BP to wait without condition ? Like liva.celmina you said, write in code stage needs modification and i have not really the time required to bring in.

Hi, I would advise looking at a permanent solution that won't need an interaction to ""allow macro"" however, to give you a quick answer regarding the wait stage, you can leave parameters blank which will give you a basic sleep period. For build efficiency & design: -If you are in a Business Object, use the Wait Stages depicted by duel stop watches -If you are in a Process, use the ""Sleep"" action within General Utilities Let me know if I can help with anything else. Thanks, James

kevin_guillemie
Level 3
Thanks James, this is a good alternative. For a better solution, i cannot launch my macro. Here the exception : ""Internal : Could not execute code stage because exception thrown by code stage: Impossible d'exécuter la macro 'Macro5'. Il est possible qu'elle ne soit pas disponible dans ce classeur ou que toutes les macros soient désactivées."" It talks that event are not Enabled while i check everywhere for having ""Event Enables"" flagged ""True"" when i create my instance and later. I think i'm not far from the solution with this option... Thanks

LakshmananMasil
Level 3
How to filter my worksheet data dynamically? please help

HI, This one may be a little tricky as I can't really see what spread sheets you are using and your set up of both the Macro & document. I would suggest that you ensure the macro you are trying to run is in the spread sheet you are interacting, if not then do one of the following: -Add it to the spread sheet -Add it to the 'Personal' attributes so that the macro can be run within any spread sheet. Make sure you double check you don't have any problems with launching normal spread sheets when this is done, as it can cause pop ups on launch of Excel. Other than the above, you will need to check to see if the Spread sheet is macro enabled i.e. .XLSM extended. You may find some problems with 97' Excel documents as these have a different form setup for extensions but few companies will use documents this old. Give the above a try and let me know if it solves the problems. Thanks, James

Hi, Can I ask what you are looking to do with the data as an end objective? It will allow me to assist more in an ideal solution. i.e. are you looking to filter & save the worksheet for others to more ideally view the information or are you looking to locate specific pieces of information to then extract? Thanks, James

LakshmananMasil
Level 3
Thanks for quick reply. My Filter criteria is dynamic. I have a config file and excel. I need to filter worksheet based on the column name specified in the config file.

Hi, Can you give me some more details around the purpose of the filter? It may be easier to pull the information from the spread sheet and use a loop and extract function to simply retrieve the data that you need. It will depend on what the filter is trying to achieve. Thanks, James