Sign in to follow this  
Followers 0
SnArF

WordDocFindReplace in header and footer

2 posts in this topic

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

 

 

 

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  
Followers 0