How to Batch Accept or Reject All Changes in Multiple Word Documents

In this post, we will focus on showing you the way to batch accept or reject all changes in multiple Word documents at the same time.

It’s easy to accept or reject all changes in one Word document. You just need to click “Review” tab, then click the drop-down button on “Accept” or “Reject” command. Next choose “Accept All Changes in Document” or “Reject All Changes in Document”.

Then what if there are multiple documents with changes you want to accept or reject in batch? To accomplish such a task, we are going to need the following macro.Batch Accept or Reject All Changes in Multiple Word Documents

Insert a User Form

  1. First off, press “Alt+ F11” to open VBA editor in Word.
  2. Second, click “Normal”.
  3. Then click “Insert” on the menu bar.
  4. Choose “UserForm” on that menu.Click "Normal"->Click "Insert"->Choose "UserForm"
  5. Click on handles around the form to resize it properly.
  6. Press “F4” to bring out the “Properties Window” on the left-down corner.
  7. Then name the form as “frmAcceptOrRejectChanges”, and set its caption as “Accept/ Reject Changes”. Besides, set “ShowModal” as “False”.Set Form Properties
  8. Next click “Toolbox” on the menu bar.
  9. Use controls on tool box to create 3 command buttons and a label and put them such order:3 Command Buttons and 1 Label
  10. Now click on label to activate its property window. Set its caption as “Do you want to:”. It’s recommended to set the background of label as transparent. Besides, you can set the font color and size as you like.
  11. Next click on command button 1. Name it as “btnAccept”. Set the caption as “Accept All Changes in Multiple Documents”.
  12. Then double click on command button 1 and enter following codes:
Private Sub btnAccept_Click()
  Set dlgFile = Application.FileDialog(msoFileDialogFilePicker)

  With dlgFile
    dlgFile.AllowMultiSelect = True
    If .Show = -1 Then
      For nDocx = 1 To dlgFile.SelectedItems.Count
        Documents.Open dlgFile.SelectedItems(nDocx)
        Set objDocx = ActiveDocument

        objDocx.AcceptAllRevisions
        objDocx.Save
        objDocx.Close
      Next nDocx
    Else
      MsgBox ("You need to select documents first!")
      Exit Sub
    End If
  End With
  MsgBox ("You have accepted all revisions in selected documents.")
  Set objDocx = Nothing

End Sub
  1. Now back to form and click on command button 2. Name it as “btnReject”. And set the caption text as “Reject All Changes in Multiple Documents”.
  2. Similarly, double click on command button 2 and input these codes:
Private Sub btnReject_Click()
  Set dlgFile = Application.FileDialog(msoFileDialogFilePicker)  
    
  With dlgFile
    dlgFile.AllowMultiSelect = True
    If .Show = -1 Then
      For nDocx = 1 To dlgFile.SelectedItems.Count
        Documents.Open dlgFile.SelectedItems(nDocx)
        Set objDocx = ActiveDocument
              
        objDocx.RejectAllRevisions
        objDocx.Save
        objDocx.Close
      Next nDocx
    Else
      MsgBox ("You need to select documents first!")
      Exit Sub
    End If
  End With
  MsgBox ("You have rejected all revisions in selected documents.")
  Set objDocx = Nothing
End Sub
  1. And next click on command button 3. Name it as “btnClose” and set caption as “Close”.
  2. Likewise, double click on command button 3 and type codes:
Private Sub btnClose_Click()
  Unload Me
End Sub
  1. Save all codes.Paste Codes->Click "Save"

Insert a Module

  1. To begin with, repeat step 2 and 3 above.
  2. And this time choose “Module”.
  3. Double click to enter the new module and enter this macro:
Sub ShowAcceptOrRejectForm()
  frmAcceptOrRejectRevisions.Show
End Sub
  1. Save the macro. You can choose to assign a button for this macro. For detailed steps, you can follow this link for reference: How to Remove the Formatting of Pasted Texts with Macro and VBA in Your Word
  2. Run the macro to rigger the user form. Click either “Accept All Changes in Multiple Documents” or “Reject All Changes in Multiple Documents”, and you will trigger the “Browse” window. Select documents and click “OK”.Select Documents->Click "OK"

Here is the result:Result Box

Handle Document Corruption

Data loss and leakage happens all the time. Some of them can be prevented, while others just occur. Therefore, it’s necessary to get hold of a tool to fix docx in times of emergency. With such a tool, you won’t need to worry about the data loss.

Author Introduction:

Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including Excel fix and pdf repair software products. For more information visit www.datanumen.com

3 responses to “How to Batch Accept or Reject All Changes in Multiple Word Documents”

  1. I don’t know about writing a macro to remove comments in batch, but there are tools that can do that out-of-the-box, like BatchPurifier. It costs a bit of money, but it can also remove tracked changes, document properties, etc. and it’s more convenient than macros, with a nicer user interface.

  2. small – error in the code. But the code works great.
    frmAcceptOrRejectRevisions.Show should read frmAcceptOrRejectChanges.Show

  3. Could anyone add also delete all comments to this macro? This would be amazing for me, it would literally save me hours of work.

Leave a Reply

Your email address will not be published. Required fields are marked *