romandas has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to use Perl's Win32::OLE module (via Dave Roth's excellent book) to automate a couple tasks I need to repeatedly perform on some Word documents. However, the book (and most web examples) tends to use Excel for examples, so I am not sure how to copy and paste effectively with the Tables collection object.
Here is a snippet of my code:
my $originalDoc = $MSWord->Documents->Open('C:\Perl\testDocument.doc') +; my $newDoc = $MSWord->Documents->Add; my $selection = $MSWord->Selection(); # this may be spurious my $count = int( $originalDoc->Tables()->{Count} ); my $range = $originalDoc->Tables()->Range( { Start => $originalDoc->Ta +bles(1)->{Range}->{Start}, End => $originalDoc->Ta +bles($count)->{Range}->{End} } ); $range->Copy(); $newDoc->Range()->Paste();
I'm getting a rather strange 'not enough storage to complete this action' error. How can I properly copy a range of tables from $originalDoc to $newDoc?
The original code used Paragraphs, not Tables, so I assume some of the bugs are artifacts from that code (or more likely my non-understanding of that code).
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How can I copy and paste a range of tables in Word with Win32::OLE?
by jrsimmon (Hermit) on Sep 16, 2009 at 20:18 UTC | |
by Bloodnok (Vicar) on Sep 16, 2009 at 21:50 UTC | |
by romandas (Pilgrim) on Sep 17, 2009 at 13:40 UTC | |
by jrsimmon (Hermit) on Sep 17, 2009 at 13:48 UTC | |
by romandas (Pilgrim) on Sep 17, 2009 at 14:04 UTC | |
by Anonymous Monk on Sep 17, 2009 at 14:37 UTC | |
|
Back to
Seekers of Perl Wisdom