View Single Post
 
Old 10-31-2023, 07:20 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,995
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

Without seeing your document it is hard to predict why you are having this problem in some docs but not others. Based on the line throwing the code I would assume that the revision is in a 'range' that can't be defined for some reason.

A quick fix and dirty fix would be to tell your macro to ignore errors by adding a line at the top of the code which says
On Error Resume Next

We could ask why a particular range is causing the error. We could step through the code and see which Revision is not able to define a range. Could it be in a header/footer, text box, footnote, endnote for instance? However the problem may be something else entirely...

If the revision is to delete text AND you accept that revision, what exactly do you think would be highlighted? And it is a general problem if you are looping through a collection if you are removing collection items as you go - this is why you might see code that steps backwards through numbered items.

So maybe you need to think about what exactly it is you want the macro to do and we can suggest some alternative code to achieve that aim. Tracked Revisions have a type that could provide guidance eg
Addition = Accept and highlight
Deletion = Reject and show as strikethrough
Format Change = Accept and highlight as another colour
Moved??

Maybe start by trying the code on these threads https://www.msofficeforums.com/word-...tain-font.html
https://www.msofficeforums.com/word/...-document.html
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote