S
shahrahulb
my $excel =
Win32::OLE->GetActiveObject('Excel.Application')
||
Win32::OLE->new('Excel.Application', 'Quit');
my $Book = $excel->Workbooks->Open("C:\\test.xls") || die "Error";
my $comp = $Book->VBProject->VBComponents->Add(1);
$comp->{Name} = 'my_macros';
# Add our subroutine to the module.
my $module = $comp->Codemodule;
$module->AddFromString($code);
Problem i sthis adds the macro ($code) to the module
Is there a way to add the macro to Sheet1 (because my exception
sub-routine works only from sheet1 and not from module)
Win32::OLE->GetActiveObject('Excel.Application')
||
Win32::OLE->new('Excel.Application', 'Quit');
my $Book = $excel->Workbooks->Open("C:\\test.xls") || die "Error";
my $comp = $Book->VBProject->VBComponents->Add(1);
$comp->{Name} = 'my_macros';
# Add our subroutine to the module.
my $module = $comp->Codemodule;
$module->AddFromString($code);
Problem i sthis adds the macro ($code) to the module
Is there a way to add the macro to Sheet1 (because my exception
sub-routine works only from sheet1 and not from module)