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


In reply to Macro goto xlate help by MJaskilka

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.