Jump to content
Sign in to follow this  
ndandy

_WordDocFindReplace in header / footer

Recommended Posts

ndandy

How to use _WordDocFindReplace in the header and in the footer section of a word document?

Share this post


Link to post
Share on other sites
ndandy

Here my solution:

; find and replace in body
$oDoc.Range.Select();  
_WordDocFindReplace($oDoc,$search,$replace,2,-1)    
  
$count_sections=$oDoc.Sections.Count()
For $sec_i=1 To $count_sections

  ; select one header section 
  $oDoc.Sections($sec_i).Headers(1).Range.Select()
  ; replace in header
  _WordDocFindReplace($oDoc,$search,$replace,2,-1)  

  ; select one footer section
  $oDoc.Sections($sec_i).Footers(1).Range.Select()
  ; replace in footer
  _WordDocFindReplace($oDoc,$search,$replace,2,-1)  
    
Next
  
; restore print layout view
$oDoc.Activewindow.View.Type = 6

:)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.