#!perl use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Word'; $Win32::OLE::Warn = 2; my $Word = Win32::OLE->GetActiveObject('Word.Application') || Win32::OLE->new('Word.Application', 'Quit'); $Word->{'Visible'} = 1; $Word->Documents->Add || die("Unable to create document ", Win32::OLE->LastError()); my $MyRange = $Word->ActiveDocument->Content; #Label L7651 is the one we want $Word->MailingLabel->CreateNewDocument({Name=>'L7651', Address=>"", AutoText=>"ToolsCreateLabels1", LaserTray=>wdPrinterManualFeed}); my ($row,$col)=(1,1); #Each barcode is in a separate file like 99990000.png for (my $x = 99990000; $x<99990065;$x++) { my $file = "C:\\mbc\\$x.png"; if ($col > 5) { $col = 1; $row++; } $Word->ActiveDocument->Tables(1)->Cell($row,$col)->Select; $Word->Selection->InlineShapes->AddPicture( {FileName=>$file, LinkToFile=>'False', SaveWithDocument=>'True'}); } print Win32::OLE->LastError();