Hello All
I am automating the "magazine run" process for a Classic Car club, this involves creating renewal letters in which I include in the letter all the cars that each member owns. I do this via a "catalog" mail merge in word which I control through a Perl script. Adding the cars into a table in this method creates a small one-line table for each car added in the mail merge. When finished, I need to run a "TableJoiner" macro so that all of these individual tables are joined up into one. I found this macro on the internet from a very helpful tutorial on the "catalog" mail merge, it works superbly and it looks like this:
Sub TableJoiner() Application.ScreenUpdating = False Dim oPara As Paragraph For Each oPara In ActiveDocument.Paragraphs With oPara.Range If .Information(wdWithInTable) = True Then With .Next If .Information(wdWithInTable) = False Then If .Text = vbCr Then .Delete End If End With End If End With Next Application.ScreenUpdating = True End Sub
I want to turn this into Perl OLE script so that I can run it on any PC without installing the macro into MS-Word first. Can anyone help me with this please? I have got as far as this:
foreach my $oPara (%{$Word->ActiveDocument->Paragraphs}) { if ($oPara->Range->Information(wdWithInTable)) { if ($oPara->Next->Information(wdWithInTable) eq False) { if ($oPara->Next->Text eq "\r") #vbCr { logoutput("Deleting Line\n"); $oPara->Range->Next->Delete; } } } }
I did start the foreach loop with:
foreach my $oPara ($Word->ActiveDocument->Paragraphs)
But I thought I needed to 'persuade' perl that it was a hash. Any help you can give me would be much appreciated.
Thanks.
In reply to MS-Word OLE and Joining Tables by BrianP6
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |