Skip to Main Content

General Development Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Oracle Forms 6i, OLE2 and Excel: Duplicate sheets

user-1kpwiApr 3 2023

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.

Comments
Post Details
Added on Apr 3 2023
0 comments
333 views