Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-23-2021, 02:08 AM
maimi23 maimi23 is offline batch compare word file Windows 10 batch compare word file Office 2016
Novice
batch compare word file
 
Join Date: Sep 2021
Posts: 1
maimi23 is on a distinguished road
Default batch compare word file

I have one folder called "RAW" contains 30 .rtf files, and another folder called "NEW" contains 30 .rtf files with same name with the raw folder.

I can compare them one by one using the word compare option, but it is tedious. Can i have a method to compare them one by one automatically, and store all the compared files with editing mode in a third new folder?

I have wrote a VBA macro, but it can not work accurately:
************************************************** ***
Sub TFL_Review()
Dim fldrVersion1 As String, fldrVersion2 As String
Dim strVersion1 As String, strVersion2 As String
Dim docVersion1 As Document, docVersion2 As Document
Dim docCompareTarget As Document
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
With fd
.Title = "Select the folder that contains the original files."
If .Show = -1 Then
fldrVersion1 = .SelectedItems(1)
Else
MsgBox "You did not select a folder."
Exit Sub
End If
End With
With fd
.Title = "Select the folder that contains the revised files."
If .Show = -1 Then
fldrVersion2 = .SelectedItems(1)
Else
MsgBox "You did not select a folder."
Exit Sub
End If
MsgBox fldrVersion1
End With
'For i = 1 To 2
'fldrVersion1 = fldrVersion1 & "\Folder" & i & ""
'fldrVersion2 = fldrVersion2 & "\Folder" & i & ""
fldrVersion1 = fldrVersion1 & ""
fldrVersion2 = fldrVersion2 & ""
MkDir fldrVersion2 & "Compared"
strVersion1 = Dir$(fldrVersion1 & "*.rtf*")
While strVersion1 <> ""
'Set docVersion1 = Documents.Open(strfldrVersion1 & strVersion1)
'Set docVersion2 = Documents.Open(strfldrVersion1 & docVersion1.Name)
Set docVersion1 = Documents.Open(fldrVersion1 & strVersion1)
Set docVersion2 = Documents.Open(fldrVersion1 & docVersion1.Name)
docVersion1.Compare Name:=docVersion2, CompareTarget:=wdCompareTargetNew
ActiveDocument.SaveAs2 fldrVersion2 & "Compared" & docVersion1.Name
ActiveDocument.Close
docVersion1.Close wdDoNotSaveChanges
docVersion2.Close wdDoNotSaveChanges
strVersion1 = Dir$()
Wend
'Next i


End Sub
Reply With Quote
 

Tags
vba compare word

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
batch compare word file Batch applying a macro to remove Header and Footer using Batch Auto Addin Edszx Word VBA 2 05-27-2019 11:16 PM
Save Word as TXT File (per batch) aarona Word VBA 0 07-07-2017 04:31 AM
batch compare word file VBA batch file to insert text at end of 50 files slow, 90% CPU usage equalizer88 Word VBA 3 08-16-2015 04:56 PM
batch compare word file VBA Batch Find & Replace for all MSOffice extensions, to replace File Name and Content of the File QA_Compliance_Advisor Word VBA 11 09-11-2014 11:51 PM
batch compare word file batch file romanticbiro Office 1 06-30-2014 06:04 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:25 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft