Excel VBA Programming: Word Document Compare?

K

Keri B

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/tutorial...a6d8-f66b277ca1f5/wininethttpsend-worlds.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top