Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-04-2023, 05:39 AM
kae0088 kae0088 is offline Error 5852 when stepping through revisions Windows 7 64bit Error 5852 when stepping through revisions Office 2010 32bit
Novice
Error 5852 when stepping through revisions
 
Join Date: May 2012
Location: Melbourne, Australia
Posts: 20
kae0088 is on a distinguished road
Default Error 5852 when stepping through revisions

The following code works on documents with a moderate number of revisions. But on a document with 7672 revisions is raises a 5852 error on the 3448th revision. There is nothing wrong with this revision and adding or deleting previous revisions just moves the stopping point to another revision.


Code:
Sub StepRevisions()
    Dim Rv As Revision
    For Each Rv In ActiveDocument.Revisions
         RvType = Rv.Type
    Next Rv
End Sub
There seems to be no way of trapping this error.


Furthermore, each time "For Each Rv In ...." is executed takes many seconds resulting in a very long processing time. One would expect that stepping through a collection would be fast.

Code:
For k=1 to RvMax
  Set  Rv = ActiveDocument.Revisions
takes even longer time.

Can anyone help me with these problems?
Reply With Quote
  #2  
Old 07-04-2023, 04:07 PM
Guessed's Avatar
Guessed Guessed is offline Error 5852 when stepping through revisions Windows 10 Error 5852 when stepping through revisions Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

It sounds like your memory is getting filled by repeatedly setting the value of RvType. What is the error message associated with 5852?

How is RvType defined? How are k and RvMax defined?

Does it make a difference if you do a Save somewhere in the loop? eg after every 500 revs.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 07-05-2023, 03:37 AM
kae0088 kae0088 is offline Error 5852 when stepping through revisions Windows 7 64bit Error 5852 when stepping through revisions Office 2010 32bit
Novice
Error 5852 when stepping through revisions
 
Join Date: May 2012
Location: Melbourne, Australia
Posts: 20
kae0088 is on a distinguished road
Default

The error message is Error 5852 Requested object is not available.


RvType and RvMax are defined as long.


What makes a difference is to change the document View to Draft. The routine will thenstep through all 7672 revisions without the error message occurring.


However, it still takes about 20 minutes in Word 2019 64 bit but only 50 seconds in Word 2016 32 bit.
Reply With Quote
  #4  
Old 07-05-2023, 06:11 PM
Guessed's Avatar
Guessed Guessed is offline Error 5852 when stepping through revisions Windows 10 Error 5852 when stepping through revisions Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Does it help speed it up and avoid errors if you also stop repagination and screen updates
Code:
Application.Options.Pagination = False
Application.ScreenUpdating = False
Don't forget to turn these back on at the end of the macro.

FWIW I have a strong dislike of Tracked Revisions and believe that tracking any more than about 100 of them in a single document is completely pointless. If you only track 'important' changes then tracked revisions have a real purpose (drawing attention to changes that NEED to be reviewed). If you track 7000 changes then no attention will be given to any more than the first page of changes. Word slows significantly with large numbers of tracked revisions and the likelihood of document corruption (or failing macros) increases significantly especially when multi-authoring in Sharepoint.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #5  
Old 07-07-2023, 02:55 AM
kae0088 kae0088 is offline Error 5852 when stepping through revisions Windows 10 Error 5852 when stepping through revisions Office 2016
Novice
Error 5852 when stepping through revisions
 
Join Date: May 2012
Location: Melbourne, Australia
Posts: 20
kae0088 is on a distinguished road
Default

Editor’s clients often insist on Track Changes and it is not uncommon to have over 7000 revisions in a large document. Besides, it indicates that the editor has earned their fee.


Turning off pagination only applies to Draft view and turning off screen updating does not solve the problem.


I upgraded to Word 2021 and the problems disappeared. There is now no apparent limit to the number of revisions and the processing time for a particular document was reduced from 20 minutes to 44 seconds.


Several users I have been in contact with have said that Word 2019 has become unstable following recent updates. It appears that bugs have been introduced and some of them involve revisions.


My macros need to be run in different versions of Word. I could use compiler directives if I can determine work arounds for the 2019 problems.
Reply With Quote
Reply

Tags
error 5852, revisioms, word vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error 5852 when stepping through revisions Revisions Sentences Word Count Regev Word VBA 1 01-31-2018 01:06 PM
Error 5852 when stepping through revisions How to open the Revisions pane? billy8b8 PowerPoint 4 12-17-2014 04:22 PM
stepping through a conversation BobbyAre Outlook 1 04-29-2012 10:28 AM
Code Error - Hiding comments and revisions silvrwoman Word VBA 6 03-24-2012 10:15 PM
Why run-time is always different from stepping into the codes? tinfanide Excel Programming 1 03-04-2012 12:04 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:50 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft