Excel Macros on multiple Worksheets

Dear Members,

I am new to blue prism and i would like to create a process which involves running a single Macro in different workbooks and different worksheets of excel so can you please help make dynamic values of macros for Blue Prism so whenever macro is running it is picking itself different Worksheets or workbooks name from database. Any help will be appreciated.

Hi Adil,

as far as I know, you can use a code stage with variable inputs but I found writing code in Blue Prism very difficult because of different version of VBA code and also debugging is very difficult as you cannot step through the code.

That's why I usually work with two excel files. "Macro & Config file" (1) sending code to excel file (2) I actually need to really handle.
For that I use robot to write the inputs including excel file (2) names into Macro & Config file (1). Macro starts with reading the inputs and eventually activates the excel file (2).

This way Robot writes only the inputs into Macro & Config (1) file and starts Run macro stage. The rest is left for VBA macro in Macro & Config file (1)

Pros: for me, the VBA is easier and more straightforward to do any work in excel and debug the code if needed rather then using Blue Prism.
Also with Macro and Config file you can easily use formulas to generate more variables or inputs, for example by using handy workbook name (2)
View attachment Capture.JPG

Cons: robot starts the Run macro stage and it is waiting for the code to finish. If there is an error in the code it will never finish and that means robots gets stuck. You must be super sure that your code is free of errors.