Run Macro from another file


I need to run a macro from a Template on another file. I’m trying to

  • 1 ) Open template file with macro (Use excel)
  • 2 ) Open the file where i need to run the macro
    1. Use ‘Run Spreadsheet Macro’ activity

I have a error message : Run Spreadsheet Macro: Sorry… Excel cannot open two workbooks with the same name at the same time.

Do you have a idea for solve my issue ?


Can you do it manually? If yes then what Is being done differently through UiPath?

I’m asking because the OS (Windows) will not allow you to open two files with same name and extension no matter how you do it, manul or automated.


I can do it manually if i copy/paste macro to 2nd file


Could you maybe please share the xaml (exclude any work sensitive information)?

@LUCIEN_Ludovic_97 you can save your macro code in .vbs format and you can run it in the desired file. Step:

  1. Use Excel Application Scope
  2. Drag the invoke vba activity and pass your .vbs file path
  3. Use close workbook activity to
    use the attached file for refrence
    GTMDT-InputFile-RefreshLinkFile.xaml (7.7 KB)
    close the workbook