MJaskilka has asked for the wisdom of the Perl Monks concerning the following question:
Dear PerlMonkers, I'm still having difficulty with a script to update a Word document. I have a Perl script that basically does what I want it to do which is to seek the current page header, select all, then do an update, which updates the display in the header of the document to display the value of a DocProperty field. That part of the code looks like this:
$word_app->ActiveWindow->ActivePane->View->{Type} = wdPrintView; $word_app->ActiveWindow->ActivePane->View->{SeekView} = wdSeekCurrentP +ageHeader; $word_app->Selection->WholeStory; $word_app->Selection->Field->Update;
Now, the problem is that many Word Documents have more than one Section, so I’m now trying to loop this to go through and update every section. The above code only updates the first section of the document so… now I’m doing:
My $sections = $doc->Sections->Count(); $word_app->ActiveWindow->ActivePane->View->{Type} = wdPrintView; For ($i=1; $i<=$sections; $i++){ #Macro to translate: Selection.GoTo What:=wdGoToSection, which:=wd +GoToNext, Count:=1, Name:=”” #Next line is an attempt to translate but it is NOT working, saying + bad parameter… $word_app->ActiveWindow->Selection->GoTo(“wdGoToSection”, “wdGoToNe +xt”, 1, 0); $word_app->ActiveWindow->ActivePane->View->{SeekView} = wdSeekCurre +ntPageHeader; $word_app->Selection->WholeStory; $word_app->Selection->Field->Update; }
This second part still only updates the first section because the one line to goto the next section is NOT working... Do you have any ideas that would help me out?? Thanks so much! Mark
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Macro goto xlate help
by Corion (Patriarch) on Oct 11, 2010 at 17:24 UTC | |
by Anonymous Monk on Oct 12, 2010 at 16:47 UTC | |
|
Re: Macro goto xlate help
by Anonymous Monk on Oct 11, 2010 at 19:30 UTC |