UiPath Dynamic macro SOlution needed

Business is provided me a macro enabled workbook.
The workbook has a macro in-built say “A”.
The macro has a path mentioned and the bot needs to change the path and run the macro “A”.
Can anyone tell me the logic?

To change the path mentioned in an Excel macro and then run the macro using UiPath, you can follow these steps:

1.Open Excel Workbook:

Use the “Excel Application Scope” activity to open the macro-enabled workbook.

2.Modify the Macro Path:

You can use the “Excel Application Scope” to manipulate the Excel workbook. Use the “Excel Application Scope” to open the workbook, and then use the “Execute Macro” activity to run the following VBA code

Sub ChangeMacroPath()
’ Change the path in your macro
’ For example, if the path is in a cell:
Range(“A1”).Value = “New_Path_Goes_Here”
End Sub

3.Run the Macro:

  • After modifying the macro path, you can run the macro “A” using the “Execute Macro” activity. Specify the macro name (which is “A” in your case) and any required parameters.

4.Save and Close:

  • Use the “Save Workbook” activity to save the changes, and the “Close Workbook” activity to close the Excel workbook.


inside the macro A the path is given like this

set filepath = “path”

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.