×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

VB script for comparing Word documents

VB script for comparing Word documents

VB script for comparing Word documents

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close