I did this, but can't share the code, unfortunately.
It's not easy, but here are the steps as I remember them:
- You have to unzip the word document into its component files.
- Open the right file, which will be XML, and find your tags. Note that the text might be intermingled with formatting code and the like.
- Change the tags, then zip the whole thing up and rename it with the .docx extension.
You can do the unzipping/zipping entirely in Xojo code use @ThomasTempelmann 's ZipArchive, or via a Shell on the Mac and OLE on Windows.