View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Keri B Keri B is offline
external usenet poster
 
Posts: 1
Default 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