cmiller2005 has asked for the wisdom of the Perl Monks concerning the following question:
I would like to perform a mail merge with Word 2007 and a tab delimited text file using Perl. I have tried the code below but all it does is create a copy of the Word template without any merge taking place. I think I'm missing something somewhere as I am not well versed in Perl. When I do the merge manually it works fine. Can someone help me out?
Thanks in advance for any and all help, Carluse strict; use warnings; use Win32::OLE ; use Win32::OLE::Const 'Microsoft Word'; my $sourcefile='C:\Users\Carl\Documents\AddressMergeTXT.txt'; my $mergefile='C:\Users\Carl\Documents\Merge.docx'; my $template = 'C:\Users\Carl\Documents\MergeLetter.docx'; my $Word= Win32::OLE->new('Word.Application', 'Quit'); $Word->Documents->Open($template); $Word->ActiveDocument->MailMerge->OpenDataSource($sourcefile); $Word->ActiveDocument->SaveAs($mergefile);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mail Merge with Word 2007 and Perl
by roboticus (Chancellor) on Aug 17, 2014 at 00:10 UTC | |
|
Re: Mail Merge with Word 2007 and Perl
by cmiller2005 (Initiate) on Aug 19, 2014 at 15:35 UTC | |
by roboticus (Chancellor) on Aug 19, 2014 at 17:57 UTC | |
by cmiller2005 (Initiate) on Aug 20, 2014 at 13:46 UTC | |
by roboticus (Chancellor) on Aug 20, 2014 at 14:50 UTC | |
by cmiller2005 (Initiate) on Aug 21, 2014 at 02:22 UTC | |
|