Macro file issue

Hi, whenever I ran a bot to copy different sheets from an excel file and paste it into a new separate excel file I got a dialog box. After clicking manually on the end button the bot ran fine. Does anybody have a solution on how to tackle it?
TIA
image

Hi Cuberoot,

Can you please provide Macro file and UiPath solution.

Regards,
Firoz

can you please share your code?

Or try to use the below vba code

Dim srcWorkbook As Workbook
Dim destWorkbook As Workbook

Set srcWorkbook = Workbooks.Open("C:\path\to\source.xlsx")
Set destWorkbook = Workbooks.Open("C:\path\to\destination.xlsx")
srcWorkbook.Sheets("Sheet1").Select
srcWorkbook.Sheets("Sheet1").Copy Before:=destWorkbook.Sheets(1)
destWorkbook.Save
destWorkbook.Close
srcWorkbook.Close
1 Like

I can’t share it

what is the method name?

did not get you.

when I write the above code in VBA, then what should I write in the VBA method name?

not working

Sub CopyMacroSheets ()
Dim srcWorkbook As Workbook
Dim destWorkbook As Workbook

Set srcWorkbook = Workbooks.Open(“C:\Users\I\Documents\AAM\Daily Tasks\My folder\net45\Input\28Jan2023\ Input Data.xlsx”)
Set destWorkbook = Workbooks.Open(“C:\Users\I\Documents\M\Daily Tasks\My folder\net45\Input\29Jan2023\Input Data.xlsx”)
srcWorkbook.Sheets(“AHMN”).Select
srcWorkbook.Sheets(“AHMN”).Copy Before:=destWorkbook.Sheets(1)
destWorkbook.Save
destWorkbook.Close
srcWorkbook.Close
End Sub