#Do the most simple thing: create variables. my $EXCEL = 'Excel.Application'; my $WORD = 'Word.Application'; my $excel = Win32::OLE->GetActiveObject($WORD)