Copy or duplicate excel sheet

Started by JuanVelazquez, October 28, 2019, 08:51:50 AM

Previous topic - Next topic

JuanVelazquez

Good morning

I have an excel book which is composed of several sheets. Currently I have the need to copy or duplicate one of the sheets within the same book but I have not got the form.

The syntax used in VB is:
Worksheets ("Source"). Copy After: = Worksheets ("Final")

Where "Origin" is the sheet to be copied and will be located after the "Final" sheet.

So far I have not been able to properly use the Copy property.

I currently use the object:
DEF OBJECT ex, "excel.application"

Thank you very much for the help you can give me.

Regards

Astecom - Koen

->def object excel,"Excel.Application"
->workbook=excel'workbooks'open("filename.xlsx")
->workbook'worksheets("Origin")'copy(*,*workbook'worksheets("Final"))
->excel'visible=1

By default you'll end up with a new worksheet named "Origin (2)".

JuanVelazquez

Quote from: koenv on October 28, 2019, 10:10:58 AM
->def object excel,"Excel.Application"
->workbook=excel'workbooks'open("filename.xlsx")
->workbook'worksheets("Origin")'copy(*,*workbook'worksheets("Final"))
->excel'visible=1

By default you'll end up with a new worksheet named "Origin (2)".

Hi Koenv

Thanks for the help, it worked perfectly

Regards