Running Macro from the Studio

  • 8 April 2020
  • 6 replies
  • 34 views

To run a macro from the Studio or the Robot the following points should be considered and configured:

 

  1. If the VBA code is embedded inside the excel sheet then the exact Module name and Procedure name should be mentioned inside "Run Macro' AC.
  2. Don't forget to save the excel file with .xlsm extension or change its extension from .xlsx to .xlsm.
  3. The Wizard should contain AC "Set user interaction" as Ignore, because the code that macro is executing will be considered as an external user actions for the Studio or Robot and it will pause the wizard.

Attached you will find a sample macro enabled excel file and the wizard. Adjust the new excel file in the wizard and run to test it.

 


6 replies

Badge +2

Hi Artur ,

I would like to run this macro on an excel file that I have :

Dim lr As Long

lr = Cells(Rows.Count, 1).End(xlUp).Row

Range("G2:G" & lr).formula = "=COUNTIF(F:F,F2)"

 

how can I see the result on the same file im running the macro on ? or how can I make it run actually ?

 

Hi Nawras,

 

In order to run it on you excel file, you need to replicate the same scenario but using your excel file.

Just download the zip folder, extract it and replace the excel file with your excel file.

Make sure that you change the Module and Procedure names and use those that are in your excel file.

If you get any issues, you can send me your excel file then I can put all together.

Don't forget to change your Excel extension from .xlsx to .xlsm.

Badge +2

I want to run the macro through Run Macro AC , I am not sure how does this AC work , I wrote the code in it and chose the excel file ( the macro is not embedded in the excel because I run it on different excel files that I create) .

what does actually happen when the Run Macro AC ends ?

Thanks for your help 🙂

Hi,

Even if the script is not in the excel file on which you want to run you still need to have a .xlsm from where the commands will pass to your desired file.

You can select a "Custom macro" option but you still need a .xlsm excel sheet and the procedure name.

I am attaching a sample where a custom script has been used, extract the files, upload the wizard to your environment, change the ExcelPath variable and make sure that this works on your end.Afterwards, you can modify it with your custom code.

Badge +2

Got it , it worked !

Thank you alot

Badge +2

Hello, 

is there any issue with “Run Macro” AC in version 21.10.5.5?

running this returns “CODE_ERROR” now ..

Reply