none
Word document with pending changes ??? RRS feed

  • Question

  • I'm trying to write a set of Word macros to automate versioning of some documents we handle. Its working pretty well but every so often I find a Word doc that appears to have pending changes saved within it. For example I open the document, then immediately X out of it then it askes me if 'do you want to save the changes, yes no or cancel. On open, I have an autoopen() macro which runs and on close, I have an autoclose() macro which runs. Any idea what could be causing this? It only happens with certain documents. Could some attribute be being set in my macro that makes Word think it always has pending changes?

    This is Word 2003

    Thursday, May 19, 2011 7:09 PM

Answers

  • Is there an UpdateStyles command in your code? That could trigger pending changes in some documents.

    I'm assuming your code is an a custom template, correct? If so, is there any code in the ThisDocument class, Document_Open event that places something in the document or updates it in someway?

    One more thing I can think of are links that would get updated on open based on that Word > Options setting. Do these particular document have links?


    Wag and they wag with you, Howl and they put you outside. http://greatcirclelearning.com
    Thursday, May 19, 2011 8:13 PM
  • This could be triggered by various fields in the document or auto-updating of Styles. If you know you're not making changes, simply use the DoNotSaveChanges directive. For example:
    ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges


    Cheers
    Paul Edstein
    [MS MVP - Word]
    Friday, May 20, 2011 6:05 AM

All replies

  • Is there an UpdateStyles command in your code? That could trigger pending changes in some documents.

    I'm assuming your code is an a custom template, correct? If so, is there any code in the ThisDocument class, Document_Open event that places something in the document or updates it in someway?

    One more thing I can think of are links that would get updated on open based on that Word > Options setting. Do these particular document have links?


    Wag and they wag with you, Howl and they put you outside. http://greatcirclelearning.com
    Thursday, May 19, 2011 8:13 PM
  • This could be triggered by various fields in the document or auto-updating of Styles. If you know you're not making changes, simply use the DoNotSaveChanges directive. For example:
    ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges


    Cheers
    Paul Edstein
    [MS MVP - Word]
    Friday, May 20, 2011 6:05 AM