When Word comes up with this error, it is primarily to do with RAM. I have had this message quite regularly with large complex documents (usually with lots of tables or forms) even on my 128MB RAM Compaq P500. It occurs all the time with such documents on less able machines.
The error is definately Word based, and the only solution I have found, apart from adding more RAM, is to make sure you save the document regularly.
It may be an idea to insert some more code into your C++ application, perhaps something that saves the document halfway through it's building of the form and then conitnues. The problem resides with Word's undo function. It has trouble saving all the actions it needs to undo and that is why you get the error message. If you save and close the document and then re-open it it starts to work fine again, so perhaps the document could be saved into temp, re-opened and the rest of the process continues.
Hope this provides some pointers