Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Microsoft Word Script: First Header Range Select

$
0
0

Hopefully I'm overlooking a simple fix?

 

This simple find/replace script has hit a wrench: the script I'm using to find/replace the header/footer does not target the first page header/footer.

 

Any insights? Here's what I'm working with currently:

  1.    ;Find/replace for new product name in the body of the document
  2.    _Word_DocFindReplace($oDoc, "PROFILENAME", $aFileArray[$count])
  3.    Sleep(500)
  4.  
  5.    ;Selects the header and finds/replaces there too
  6.    $count_sections=$oDoc.Sections.Count()
  7.    For $sec_i=1 To $count_sections
  8.       ; select one header section
  9.       $oDoc.Sections($sec_i).Headers(1).Range.Select()
  10.       ; replace in header
  11.       _Word_DocFindReplace($oDoc, "PROFILENAME", $aFileArray[$count], 2, -1)
  12.  
  13.       ; select one footer section
  14.       $oDoc.Sections($sec_i).Footers(1).Range.Select()
  15.       ; replace in footer
  16.       _Word_DocFindReplace($oDoc, "PROFILENAME", $aFileArray[$count], 2, -1)
  17.       Next
  18.  
  19.    ; restore print layout view
  20.    $oDoc.Activewindow.View.Type = 6

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>