Hi everybody.
I have an excel template with a sheet (C1I1) that I need to duplicate N times. I'm unable to do that.
I've tried adding the main sheet to the workbook, to the worksheets, copying the sheet to a new one and adding it to the workbook, the worksheets... with zero results.
For example this tries:
ole2.add_arg(args, 'After');
ole2.add_arg(args, ole2.GET_OBJ_PROPERTY(application,'ActiveSheet'));
ole2.invoke(worksheet, 'Copy', args);
ole2.add_arg(args, 'After');
ole2.add_arg(args, 'C1I1');
ole2.invoke(worksheet, 'Copy', args);
ole2.add_arg(args, 'After');
ole2.add_arg(args, worksheet);
ole2.invoke(worksheet, 'Copy', args);
ole2.add_arg(args, 'After:C1I1');
ole2.invoke(worksheet, 'Copy', args);
Also:
ole2.invoke(worksheet, 'Copy After:=Sheets(1)');
and its variants.
According to documentation, it should be something like
Worksheets("Sheet1").Copy After:=Worksheets("Sheet3")
and if running a macro on the template, the result is
Sheets("C1I1").Select
Sheets("C1I1").Copy After:=Sheets(1)
but I don't know how to translate that into a invoke/invoke_org call.
The only thing I've achieved is copying the sheet into a new book with
ole2.invoke(worksheet, 'Copy');
but I need all of them on the same book.
Thank you in advance.
Amadeo.