Revisions, track changes:

T

TRM

Here is a snippet of code I have which is supposed to go through a document
(with track changes turned on) and check for any deletions, then accept them.


Dim oRvs As Object
For Each oRvs In oDoc.Revisions 'oApp.ActiveDocument.Revisions
If oRvs.type = wdRevisionDelete Then
oRvs.Accept
End If
Next

Now, it does seem to do this, however, occasionally a document will get
"hung up" in the loop - or an error message "disk is full" occurs on the
document when it is closed/saved.

I am trying to make sure I am understanding this code... I am learning and
got this code snippet from someone kind enough to post a suggestion for me.
I thought I understood what it's doing: basically checking any revisions in
the document to see if it's a deletion, then approving if it is. In trying
to trouble shoot this latest error, I'm finding I'm not entirely correct!

I created a document with approximately 15 or so "changes" (being an initial
document, they would all be tracked of course). The code looped through 19
times. I then approved the changes, and made some new ones, probably about
4, one being a deletion. The code still looped through about 18 times
(that's what I counted, it could have been 19). Now, if my thought process
was correct, it's looping through only the actual REVISIONS, then it would
have gone through the second time about 4 times - not the 18. So, does this
check just the revisions, or are there other "divisions" of the document -
such as header, footer, first page and body; or sections - or ????

Thanks for the time, clarification, and expertise!! Also, if you have a
reason why this would get "caught up" - I would appreciate thoughts about
that too!

THANKS again.
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?VFJN?=,

I think I read somewhere that this may be causing a memory leak. Might be
worthwhile to open a support incident with Microsoft.

Other than that, I can only suggest that you save on a regular basis (every 10,
50 or n loops) to try to avoid stuff "accumulating" that may be preventing the
successful save.
Here is a snippet of code I have which is supposed to go through a document
(with track changes turned on) and check for any deletions, then accept them.


Dim oRvs As Object
For Each oRvs In oDoc.Revisions 'oApp.ActiveDocument.Revisions
If oRvs.type = wdRevisionDelete Then
oRvs.Accept
End If
Next

Now, it does seem to do this, however, occasionally a document will get
"hung up" in the loop - or an error message "disk is full" occurs on the
document when it is closed/saved.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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