TuomasKemppainen
Programmer
Hi,
I have tried to create script to compare word documents. I can make a working macro in Word but when trying to do the same in VB script I'm getting error "Expected statement" for the Application.CompareDocuments row. Below is the code I'm using. Any ideas how to make this work?
Set objWord = CreateObject("Word.Application")
objWord.DisplayAlerts = WdAlertsNone
objWord.Visible = True
'Opening original and revised files
Set ORIGINAL = objWord.Documents.Open("T:\user\Tuomas.Kemppainen\00_ROOT\99_PLAYGROUND\comparefiles\original.rtf",,False)
Set REVISED = objWord.Documents.Open("T:\user\Tuomas.Kemppainen\00_ROOT\99_PLAYGROUND\comparefiles\revised.rtf",,False)
'Comparing files
Application.CompareDocuments OriginalDocument := "T:\user\Tuomas.Kemppainen\00_ROOT\99_PLAYGROUND\comparefiles\original.rtf", _
RevisedDocument := "T:\user\Tuomas.Kemppainen\00_ROOT\99_PLAYGROUND\comparefiles\original.rtf", _
Destination := wdCompareDestinationNew, _
Granularity := wdGranularityCharLevel, _
CompareFormatting := True, _
CompareCaseChanges := True, _
CompareWhitespace := True, _
CompareTables := True, _
CompareHeaders := True, _
CompareFootnotes := True, _
CompareTextboxes := True, _
CompareFields := True, _
CompareComments := True, _
CompareMoves := True, _
RevisedAuthor := "TuomasK", _
IgnoreAllComparisonWarnings := False
'Save As RTF, RTF format is 6
'objWord.SaveAs WORD_COMPARE, 6
'Close original and revised files
ORIGINAL.Close False
REVISED.Close False
objWord.Quit
I have tried to create script to compare word documents. I can make a working macro in Word but when trying to do the same in VB script I'm getting error "Expected statement" for the Application.CompareDocuments row. Below is the code I'm using. Any ideas how to make this work?
Set objWord = CreateObject("Word.Application")
objWord.DisplayAlerts = WdAlertsNone
objWord.Visible = True
'Opening original and revised files
Set ORIGINAL = objWord.Documents.Open("T:\user\Tuomas.Kemppainen\00_ROOT\99_PLAYGROUND\comparefiles\original.rtf",,False)
Set REVISED = objWord.Documents.Open("T:\user\Tuomas.Kemppainen\00_ROOT\99_PLAYGROUND\comparefiles\revised.rtf",,False)
'Comparing files
Application.CompareDocuments OriginalDocument := "T:\user\Tuomas.Kemppainen\00_ROOT\99_PLAYGROUND\comparefiles\original.rtf", _
RevisedDocument := "T:\user\Tuomas.Kemppainen\00_ROOT\99_PLAYGROUND\comparefiles\original.rtf", _
Destination := wdCompareDestinationNew, _
Granularity := wdGranularityCharLevel, _
CompareFormatting := True, _
CompareCaseChanges := True, _
CompareWhitespace := True, _
CompareTables := True, _
CompareHeaders := True, _
CompareFootnotes := True, _
CompareTextboxes := True, _
CompareFields := True, _
CompareComments := True, _
CompareMoves := True, _
RevisedAuthor := "TuomasK", _
IgnoreAllComparisonWarnings := False
'Save As RTF, RTF format is 6
'objWord.SaveAs WORD_COMPARE, 6
'Close original and revised files
ORIGINAL.Close False
REVISED.Close False
objWord.Quit