ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel VBA Programming: Word Document Compare? (https://www.excelbanter.com/excel-discussion-misc-queries/253770-excel-vba-programming-word-document-compare.html)

Keri B

Excel VBA Programming: Word Document Compare?
 

Hi.

I am attempting to get Excel to open two documents in Word, compare, merge and then copy the tracked changed per section into Excel.

I have been having a LOT of trouble finding the command through VBA to complete this. I attmepted to create a Macro in Word and copy it over to Excel but it keeps giving me an error.

Any help is appreciated.

What I have so far:


Sub Draft()


Dim wdApp As Word.Application, wdDoc As Word.Document

On Error Resume Next
Set wdApp = GetObject("Word.Application")
If Err.Number < 0 Then 'Word isn't already running
Set wdApp = CreateObject("Word.Application")
End If
On Error GoTo 0

wdApp.Visible = True

wdApp.ChangeFileOpenDirectory "C:\@Document"
wdApp.ChangeFileOpenDirectory "C:\@Document"
wdApp.MergeDocuments OriginalDocument:=Documents( _
"current rev.doc"), RevisedDocument:= _
Documents("new rev.doc"), Destination:=wdCompareDestinationNew, _
Granularity:=wdGranularityWordLevel, CompareFormatting:=False, _
CompareCaseChanges:=False, CompareWhitespace:=False, CompareTables:=True, _
CompareHeaders:=False, CompareFootnotes:=False, CompareTextboxes:=True, _
CompareFields:=False, CompareComments:=False, CompareMoves:=True, _
OriginalAuthor:="Author", RevisedAuthor:="Author", FormatFrom:= _
wdMergeFormatFromPrompt



Dim EndRun As String
EndRun = "Comparison has been entered into Excel"
MsgBox (EndRun)






Submitted via EggHeadCafe - Software Developer Portal of Choice
WinINetHTTPSend: World's Smallest HTTP Component!
http://www.eggheadcafe.com/tutorials...nd-worlds.aspx


All times are GMT +1. The time now is 01:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com