When i use my $newdoc = $word->ActiveDocument; foreach my $obj_Story ($newdoc->StoryRanges ){ $obj_Story->Fields->Update(); line 10 while (my $obj_Story = $obj_Story->NextStoryRange){ $obj_Story->Fields->Update(); } #$obj_Story->NextStoryRange;
I get the following Win32::OLE(0.1502} error 0x80020005: " Type mismatch" in METHOD/PROPERTYGET "" argument 1 at test.pl line 10 When i use my $newdoc = $word->ActiveDocument; foreach my $obj_Story ($newdoc->StoryRanges ){ $obj_Story->Fields->(Update); line 10 while (my $obj_Story = $obj_Story->NextStoryRange){ $obj_Story->Fields->(Update); line 13 } #$obj_Story->NextStoryRange; Bareword "Update" not allowed while "strict subs" in use at test1.pl line 10 Bareword "Update" not allowed while "strict subs" in use at test1.pl line 13 same error if i use update or Update Ilaiy ----- Original Message ----- From: "Tim Johnson" <[EMAIL PROTECTED]> To: "Ilaiy" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Sunday, June 13, 2004 5:45 AM Subject: RE: Microsoft Word and Perl > Try changing "Fields->{Update}" > to > "Fields->{update}" > or > "Fields->update()" > > -----Original Message----- > From: Ilaiy [mailto:[EMAIL PROTECTED] > Sent: Sat 6/12/2004 2:39 PM > To: [EMAIL PROTECTED] > Cc: > Subject: Microsoft Word and Perl > > > > I have been trying to update my word document using perl, i used > > $word->Selection->WholeStory; > $word->Selection->Fields->{Update}; > > > But this is a little slow and at times doesnot update completely. I > modified the code and right now getting a wired error but the same in > VBA works really well . > > > my $newdoc = $word->ActiveDocument; > foreach my $obj_Story ($newdoc->StoryRanges ){ > $obj_Story->Fields->{Update}; ==> Cannot find object > while ($obj_Story->NextStoryrange != ""){ > $obj_Story = $obj_Story->NextStoryRange; > $obj_Story->Fields->{Update}; ==> Cannot find object > } > } > > > The equivalent in VBA is .. > > Dim obj_Story As Range > For Each obj_Story In ActiveDocument.StoryRanges > obj_Story.Fields.update > While Not (obj_Story.NextStoryRange Is Nothing) > Set obj_Story = obj_Story.NextStoryRange > obj_Story.Fields.update > Wend > Next obj_Story > Set obj_Story = Nothing > > > > Could someone tell me where am i going on. > > > Ilaiy > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>