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.
Insert a User Form
- First off, press “Alt+ F11” to open VBA editor in Word.
- Second, click “Normal”.
- Then click “Insert” on the menu bar.
- Choose “UserForm” on that menu.
- Click on handles around the form to resize it properly.
- Press “F4” to bring out the “Properties Window” on the left-down corner.
- Then name the form as “frmAcceptOrRejectChanges”, and set its caption as “Accept/ Reject Changes”. Besides, set “ShowModal” as “False”.
- Next click “Toolbox” on the menu bar.
- Use controls on tool box to create 3 command buttons and a label and put them such order:
- 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.
- Next click on command button 1. Name it as “btnAccept”. Set the caption as “Accept All Changes in Multiple Documents”.
- 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
- 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”.
- 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
- And next click on command button 3. Name it as “btnClose” and set caption as “Close”.
- Likewise, double click on command button 3 and type codes:
Private Sub btnClose_Click() Unload Me End Sub
- Save all codes.
Insert a Module
- To begin with, repeat step 2 and 3 above.
- And this time choose “Module”.
- Double click to enter the new module and enter this macro:
Sub ShowAcceptOrRejectForm() frmAcceptOrRejectRevisions.Show End Sub
- 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
- 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”.
Here is the result:
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.
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
Could anyone add also delete all comments to this macro? This would be amazing for me, it would literally save me hours of work.