Jump to content
Sign in to follow this  

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




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.