I succesfully did Search Replace in doc docx header and footers using: this question. I am using Delphi to control Word via OLE Automation.
Now the problem is that that works only for first page in case one sets "different header for first page" or doesn't work at all if one sets "different on odd/even".
This document explains it a little more.
UPDATE:
That document linked above explains that MS Word manages header & footer as first page / Odd pages / even pages. But it is also possible to choose no one option and in this case all header and footer are the same.
IN case one does search and replace using the code I linked above it works only in case no extra options are selected, so in the case one is serachin and replacing in a document where all header and footers are the same.
If by chance that code is used against a document that has "differente header for first page" selected, serach and replace will occur only on header and footer of first page.
While it won't work at all if the only option selected is "different header and footer on odd and even pages" (and no "different on first page").
So I was asking if one already solved this problem looping coorectly through all cases. I mean, it would be useful to find this answer also for other users that need to do search and replace in header and footers in MS word docs, using Delphi and OLE automation.