How tell via Automation if document has been changed?

B

Bill

If I open Word via automation and let the user view, and possibly edit,
a document, how can I tell via Automation if the document has been
changed?
 
S

Shauna Kelly

B

Bill

Shauna said:
Hi Bill

You can do this if you turn on Track Changes and then use
ActiveDocument.Revisions.Count. If it's > 0 then some changes have
been made.

You'll also need to give the user a mechanism to accept or reject the
tracked changes and to turn off tracked changes.

There's some information on how Track Changes works at
http://www.ShaunaKelly.com/word/trackchanges/HowTrackChangesWorks.html

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word

Thanks Shauna. Word knows internally that a document has benn changed
since it prompts you to save the document when you close Word only if
the document has been changed. I was hoping that there would be a way
to access that flag.
 
S

Shauna Kelly

Hi Bill

Ah - if that's all you want, you can use ActiveDocument.Saved. If it's True,
then the document is saved. If it's False then the document is "dirty" and
the user would get a "do you want to save" message on exiting Word.

But that won't necessarily tell you if the document has been changed. If I
open a document, change it and save it, then the .Saved property will be
True, but I have made changes.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top