in reply to cat worddoc1.doc worddoc2.doc worddoc3.doc > bigOlWordDoc.doc

I'm not sure on the exact syntax, but it would work something like this:
### UNTESTED use strict; use Win32::OLE; my $MSWord = Win32::OLE->new('Word.Application'); my $WordDoc1 = $MSWord->{Documents}->Open("doc1.doc",0,1); my $WordDoc2 = $MSWord->{Documents}->Open("doc2.doc",0,1); my $WordDoc3 = $MSWord->{Documents}->Open("doc3.doc",0,1); my $WordDoc4 = $MSWord->{Documents}->Open("bigdoc.doc",0,1); $WordDoc1->SelectAll()->Copy(); $WordDoc4->Paste(); $WordDoc2->SelectAll()->Copy(); $WordDoc4->Paste(); $WordDoc3->SelectAll()->Copy(); $WordDoc4->Paste(); $WordDoc4->Save(); $WordDoc1->Close(): $WordDoc2->Close(): $WordDoc3->Close(): $MSWord->Quit();

more info here

Replies are listed 'Best First'.
Re: Re: cat worddoc1.doc worddoc2.doc worddoc3.doc > bigOlWordDoc.doc
by LameNerd (Hermit) on Jan 24, 2003 at 20:33 UTC
    I can't seem to get this line to work.
    my $WordDoc1 = $MSWord->{Documents}->Open($doc1,0,1);
    $WordDoc1 is undefined after that statement so
    $WordDoc1->SelectAll()->Copy();
    fails with
    Can't call method "SelectAll" on an undefined value at C:\catword.pl line
    Thanks for that link but I do not know how to translate VB to Perl.
    Can you give me a little more help?
      Do you have MSWord installed? Is $MSWord defined before you try the open() ?
        Yes I have MSWord installed.
        And I check that $MSWord is defined with die
        my $MSWord = Win32::OLE->new('Word.Application') or die "Can't get wor +d!:$!\n";
        Is that the right way to verify that $MSWord is defined? Thanks again :)