I'd like to make some sort of parser, but I'm a bit lost.

I'd like to format a Word file, so I add to it variables like $NAME$, $ADDRESS$, etc and then I swap those variables with values from a database.

So far I've figured out how to find text in textboxes, tables, and the document itself (although Word format the variables so they are 3 different words, but that's not a problem), however I'm lost now... how can I change those variables? which functions or methods do I need to use???