Jump to content

WordDocFindReplace in header and footer


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


$search = FileFindFirstFile("*.doc")

If $search = -1 Then

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



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)



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

  • Recently Browsing   0 members

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