I have found as a user of Word that there are some things that you can do in a document that Word does not consider a ‘change’ and therefore, even when you do a File, Save, it doesn’t Save…unless you do something that it thinks is a ‘change’ and dirty the document (like pressing the spacebar and deleting it), then when you do a File, Save it actually will save the doc.
Well, now, programming I have encountered the same thing. My code has to ensure the user has saved the document prior to running (because the code is pushing the document to a web service and the file must be saved). At any rate, we get the user to save the document prior to allowing the code to run, then we post the document to the web service. This all works just fine. However, I then create a custom document property in the document and assign it either true or false to indicate whether the post was successful or not. Because the only new thing in the document since being saved is the creation of a doc property, Word doesn’t think the document contains any changes, and when I do ActiveDocument.Save, it doesn’t save. I have tried manually creating the custom doc prop, and Word does think that is a change, and will save it, but not when I do it with code. I have tested this in other documents with other code and found the same thing.
So, I am wondering if anyone knows of a way other than ActiveDocument.Save to force Word to save a document. I could of course just dirty the document by inserting a space and removing it, or some such thing, but I would rather not if there is a better alternative.