sanPerl has asked for the wisdom of the Perl Monks concerning the following question:
and my Perl script goes as follows.Selection.HomeKey wdStory Selection.Text = "This is the inserted text 1" Selection.Collapse wdCollapseEnd Selection.TypeParagraph Selection.Text = "This is the inserted text 2" Selection.Collapse wdCollapseEnd Selection.TypeParagraph
I searched from 'SuperSearch' but could Not receive satisfactory information. I would be grateful, if somebody could guide me on this. I don't expect straightforward solutions but if you could direct me to any good tutorials on this topic, I would be grateful to you.use strict; use warnings; use Win32::OLE; use Win32::OLE::Const 'Microsoft Word'; use Cwd; my ($file) = @ARGV; my $cwd_path = getcwd(); $cwd_path=~ s/\//\\/gs; my $file_name = "$cwd_path\\$file"; my $Word = Win32::OLE->new('Word.Application'); $Word->{'Visible'} = 1; $Word->Documents->Open($file_name) || die("Unable to open document", W +in32::OLE->LastError());; $Word->Selection->HomeKey (wdStory); $Word->Selection->Text="This is the inserted text"; $Word->Selection->Collapse (wdCollapseEnd); $Word->Selection->TypeParagraph; $Word->Selection->Text("This is the inserted text 2"); $Word->Selection->Collapse (wdCollapseEnd); $Word->Selection->TypeParagraph; $Word->Documents($file_name)->Save(); $Word->Quit();
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: VBA to Perl
by marto (Cardinal) on Feb 10, 2006 at 12:01 UTC | |
by Samy_rio (Vicar) on Mar 10, 2006 at 09:56 UTC | |
by marto (Cardinal) on Mar 10, 2006 at 10:16 UTC | |
by wfsp (Abbot) on Mar 10, 2006 at 10:17 UTC | |
Re: VBA to Perl
by mhacker (Sexton) on Feb 10, 2006 at 11:59 UTC | |
Re: VBA to Perl
by BrowserUk (Patriarch) on Feb 10, 2006 at 12:06 UTC | |
Re: VBA to Perl
by aquarium (Curate) on Feb 10, 2006 at 12:03 UTC | |
Re: VBA to Perl
by planetscape (Chancellor) on Feb 11, 2006 at 07:57 UTC | |
Re: VBA to Perl
by Errto (Vicar) on Feb 10, 2006 at 19:09 UTC | |
Re: VBA to Perl
by spurperl (Priest) on Feb 11, 2006 at 06:15 UTC | |
by Anonymous Monk on Apr 02, 2009 at 06:23 UTC |