I have tried using the following Perl code, but the worksheet does not copy (nor move) and no error message is returned. Thanks in advance for your ideas.
#!/usr/bin/perl -w
use strict;
use warnings;
use OLE;
use Win32::OLE::Const 'Microsoft Excel';
my $Excel = CreateObject OLE "Excel.Application";
my $Book2 = $Excel->Workbooks->Add();
my $Book3 = $Excel->Workbooks->Open("C:\\temp\\test.xlsm");
my $Sheet3 = $Book3->Worksheets(1);
$Sheet3->Select;
$Sheet3->Move("Before" => $Book2->Worksheets(1));
$Book3->Close(0);
$Book2->SaveAs({Filename =>"C:\\temp\\new.xlsm",FileFormat => xlOpenXMLWorkbookMacroEnabled});
$Book2->Close();
$Excel -> Quit();
I found a workaround here using Copy/Paste over a large cell range. This approach could likely be refined by programatically identifying the active cell range instead of hard coding, which could also lead to some problems when going between different versions of Excel.