Question

Execute Macro automatically in BA depending on a parameter value

  • 25 September 2022
  • 4 replies
  • 61 views

Userlevel 2
Badge +7
  • Sidekick (Partner)
  • 36 replies

Hello Community,

I needed to run a specific Macro based on users parameter while running the Business report.

IF param_value = 1 then
execute Macro1
else
execute Macro2

automatically, during or just after the execution of BA report.

Is it possible to achieve? If yes, then please help me with the steps required.

 

BR Tool Information​​​​

Thanks in advance.

Rohit.


4 replies

Userlevel 3
Badge +10

What do you mean by BA report?

How does the user input this value?  Is it one of the report values?

If a PDF is created you could create a custom action on the PDF_REPORT_CREATED system event.

Userlevel 2
Badge +7

What do you mean by BA report?

How does the user input this value?  Is it one of the report values?

If a PDF is created you could create a custom action on the PDF_REPORT_CREATED system event.

@mwilson I meant the “Business report” -
 

User can input values in this dialog window.

However, I solved my requirement using alternate solution, but I will keep this thread open to see if this is also possible or not.

 

Thanks.

Userlevel 2
Badge +7

I tried the below 2 options -

Private Sub Workbook_open()

Sub Auto_Open()

But these 2 options run just after workbook gets opened, and BR tool populates the workbook after this “open” event of excel. So at the time these subprocedures run, the workbook doesn’t contain any data.

 

Is there a BR tool provided event? like “on populate”, which can trigger macros after BR tool finishes populating the data. I didn’t find such. It will be nice to have feature if BR tool also can fire some of its events. For example, “on data populate” will be handy.

 

Thanks.

Userlevel 2
Badge +7

I tried to add my macro code on WindowActivate event. It seems to be working fine. The macro executes after the data gets populated.

In the macro, I can check the parameter value then execute different block of code based on the parameter value.

Reply