Jump to content

WordDocFindReplace in header and footer


SnArF
 Share

Recommended Posts

I`m trying to Find and replace text in a header of a word doc.

When i search for a word in the document it worked perfectly, when the text is in the header it won`t work!

Pls help

CODE
#include

$search = FileFindFirstFile("*.doc")

If $search = -1 Then

MsgBox(0, "Error", "No files/directories matched the search pattern")

Exit

EndIf

While 1

$document = FileFindNextFile($search)

If @error Then ExitLoop

$oWordApp = _WordCreate("", 0, 0, 0)

$oDoc = _WordDocOpen($oWordApp, @ScriptDir & "\" & $document)

_WordDocFindReplace($oDoc, "text", "CHANGE")

_WordDocClose($oDoc, -1)

WEnd

FileClose($search)

My scripts: _ConsoleWriteLog | _FileArray2D

 

 

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...