I have a macro in Excel that inserts a new sheet based on the excisting sheet but when I run it from Studio using Execute Macro activity I get a blank sheet. It is the first part of the code that goes wrong - the copy is not excuted properly.
Because it is part of other macros running in Excel and I do not want to do small pieces from UiPath. The question here is why calling the macro from UiPath is not working properly
That’s best practice, though. The only time you should use macros is when you can’t accomplish the task with UiPath activities. Macros, as you’re seeing, are unreliable and complicated - and will be difficult for others to interpret, support, and modify in the future.
Anyway, if you run the macro directly from Excel does it work?
The Write Range activity will create a new sheet for you if the sheet name you give it doesn’t exist. Very simple way to copy a sheet. Read Range from “Sheet Name A” and Write Range to “Sheet Name B” - if “Sheet Name B” doesn’t exist it’ll be created.
I have macros running in Excel. Then I build RPA using UiPath that is getting data to the Excel sheet and at new year making a new sheet. So I do not want to rebuild all my macros to UiPath because it would take 100+ hours.
I just want to be able to run a macro from UiPath but obviously UiPath is not able to do that properly
Before calling the macro from UiPath I was using an Excel activity FindFirstLastRow in UiPath. This activity creates an empty sheet and throws an error if the sheet does not excist in Excel. So because an empty sheet was created my Excel macro could not run properly and the result was an empty sheet.