use warnings; use strict; # we are going be working with MS Word Objects use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; use Win32::OLE::Variant; $word->{Displayalerts} = 0; #### Global symbol "$word" requires explicit package name at strict.pl line 8. Execution of strict.pl aborted due to compilation errors. #### use warnings; use strict; # we are going be working with MS Word Objects use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; use Win32::OLE::Variant; my $text = ""; my $directory = "c:\\"; opendir (DH, $directory) || die "can't opendir $directory: $!"; # we are working with Word application my $Word = Win32::OLE->new('Word.Application', 'Quit'); $Word->{Displayalerts} = 0; # hide alerts $Word->{Visible}= 0; # we don't need to see Word in an active window my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); $Excel->{Displayalerts} = 0; # hide alerts my $excelfile = "E:\\assin\\foo\\sample.xlsx"; my $root = "E:\\assin\\foo"; my $doc = "E:\\assin\\foo\\Functional.doc"; #### # get the first table my $table = $Word->ActiveDocument->Tables(1); for($row=1;$row<3;$row++) { for($col=1;$col<3;$col++) { my $text = $table->Cell($row,$col)->Range->{Text}; $Sheet->Cells($row,$col)->{'Formula'}=$text; } #### for( $row = 1; $row < 3; $row++ ){ for( $col = 1; $col < 3; $col++ ){ my $text = $table->Cell($row,$col)->Range->{Text}; $Sheet->Cells($row,$col)->{'Formula'}=$text; } }