VBA or Vbscript to open Word Doc and ACCEPT all Tracked Changes

D

Dennis

Hi everyone,

Can anyone please help me by suggesting VBscript or VBA code for opening up
a Word document and Accepting all the Tracked Changes - ultimately nullifying
them from being displayed.

Ideally I need to open multiple documents in a folder, but if I can get a
piece of code that can do just one document I know how to loop it to do
n-documents.

Please AND Thank you. I appreciate your time and effort in providing an
answer for me!

Warm Regards,

Dennis
 
M

macropod

Hi Dennis,

Try:
Sub AcceptTrackedChanges()
Dim oRange As Range
With ActiveDocument
For Each oRange In .StoryRanges
oRange.Revisions.AcceptAll
Next
End With
End Sub
 
D

Doug Robbins - Word MVP

Use:

Dim arev As Revision
With ActiveDocument
For Each arev In .Revisions
arev.Accept
Next arev
End With

To do this for all the files in a folder, modify the code in the article
"Find & ReplaceAll on a batch of documents in the same folder" at:

http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm

to incorporate the above code.

Or, for an enhanced method, see the following page of fellow MVP Greg
Maxey's website:

http://gregmaxey.mvps.org/Process_Batch_Folder.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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