Link to home
Create AccountLog in
Avatar of openaccount1

asked on

Automatically accept all changes, delete all comments and switch off Track Changes in MS Word

We have a writer writing in articles for us and then someone else is commenting on the articles and doing deletions in the word documents and the changes are also being tracked because change tracking is enabled. But when everything is done we will need to open each document, accept all changes, delete all coments, and switch off Track changes. And we will do this each time on every document. Is there a way to do these actions:

1. Accept all changes
2. Delete all coments
3. Swithc off Track changes.

in Batch so that we do not need to do these one by one. It may be a macro (Please teach me how to use it if it is a macro because I really do not know macro) or a VB executable script so that all actions mentioned above can be automatically done without opening the word files individually.

Avatar of ExcelGuide
Flag of Netherlands image

Goto Tools>Macro>Visual Basic Editor

Double click on "ThisDocument" under "Microsoft Word Objects"

Copy/paste the code below.

Exit the editor

Goto Tools>Macro and click on the play button "macros" and select the macro "change" en run this.

This will do the trick, good luck.
sub change()
Dim arev As Revision
With ActiveDocument
For Each arev In .Revisions
Next arev
End With
ActiveDocument.TrackRevisions = Not ActiveDocument.TrackRevisions
end sub

Open in new window

Avatar of openaccount1


WIll this be able to do a batch change or update all files in one go?
this is only for one file. But can be done in one of the office tools (like Word, Excel etc.)

This also can be done in a VBS script as well.
OK, I am not a programmer. Can you send the vb script equivalent of the macro... and the instruction on how to use it please...

Thank you so much.
You can do this with VBA.  The below code assumes that all the files you want to change are in the same folder. (C:\MyDocs)

You will need to add the FileSystemObject to your references.
1. Open the VBE
2. Tools
3. References
4. Locate "Microsoft Scripting Runtime"
5. Place a checkmark in the option and click OK

Dawn Crosier-Bleuel
Word MVP
Sub ChangeFiles
	Dim fso As FileSystemObject
	Dim objFolder As Folder
	Dim objFile As File
	Dim strName As String
	Set fso = New FileSystemObject
	Set objFolder = fso.GetFolder("C:\MyDocs")'Or the folder you nead searched
	For Each objFile In objFolder.Files
		strName = objFile.Path
		If Right(strName, 4) = ".doc" Then
			Application.Run MacroName:="change" 'Or whatever you named your other macro
		End If
End Sub

Open in new window

Sorry... Newby here when it comes to macros or VB code. :( Can't understand... Please bear with me.... I think I may get it if you provide a word document with screenshot of what to do.

1. How and where to add the code.
2. How to execute the code.

Thank you so much.
see example.

I used my code and the code from Dawn Crosier-Bleuel, just modified this code a bit and also added more.

The only thing you have to do is just click on the button in the word document. You will be asked to choose a folder where the file are located. Then the code will be runned automatically.

Please split points between me and Dawn. Thanks.

Good luck.
Hi Again,

Another question. I double click the button in the document that you provided and it opened in the VB editor. I then click the "Play" button and an error showed up saying that the macros in the project are disabled. How can I enable it? Sorry for the bother. I really do not have knowledge about this thing.

I was able to enable the macro and yes it asked for the folder on where the documents are. However, the documents were not changed. Comments and change tracking is still visible.

Avatar of dlc110161
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
I see we forgot more. I just tested the code and no it was not working. I modified the code a bit and now it is working.

for your information:
I added some lines to actually open the file, run the macro, save and close the file.

Good luck
Hi again...

There is another error. It only opens the first document that it sees and not all documents in the folder. Also, after doing the changes can it just automatically save and close the file? Because currently it is asking you to save and close the file.

sorry didnt test this with several files, fixed the problem.

btw I did not get the question to save the file? please try this one again.
The code is working correctly now and all files are being changed. One last thing, when the files are being changed a pop up is appearing. Can this popup be eliminated? Tried the code on both Wird 2003 and 2007 and same result. See attached file for screenshot of the pop up.

Thank you.
Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Great! Everything is ok now. Thanks for the very big help.
Excellent Solution! Thank you very much! I want to reward you both more that 500 points but unfortunately 500 points is the highest.