locked
Interop Word - How to load documents to built-in wdDialogToolsCompareDocuments dialog RRS feed

  • Question

  • Hello,
    I cannot figure out how to load original and revised docs to the following built-in dialog.

    Code C#

    dynamic dialog = Application.Dialogs[Word.WdWordDialog.wdDialogToolsCompareDocuments];

    I would appreciate it if you could give me a hint on where to look for a list of properties.

    Many thanks,Frankie





    • Edited by FrantikDvojka Friday, December 4, 2020 5:42 AM adding keywords
    Tuesday, November 17, 2020 10:45 AM

All replies

  • Instead of using the dialog, I'd do something like this:

    Sub CompareDoc()
        Dim doc1 As Document
        Dim doc2 As Document
        Set doc1 = Documents.Open("C:\Word\Document1.docx")
        Set doc2 = Documents.Open("C:\Word\Document2.docx")
        Application.CompareDocuments OriginalDocument:=doc1, RevisedDocument:=doc2, _
            Destination:=wdCompareDestinationNew, Granularity:=wdGranularityWordLevel, _
            CompareFormatting:=True, CompareCaseChanges:=True, CompareWhitespace:=True, _
            CompareTables:=True, CompareHeaders:=True, CompareFootnotes:=True, _
            CompareTextboxes:=True, CompareFields:=True, CompareComments:=True, _
            CompareMoves:=True, RevisedAuthor:="My Name" & vbTab, _
            IgnoreAllComparisonWarnings:=False
        ActiveWindow.ShowSourceDocuments = wdShowSourceDocumentsBoth
    End Sub


    Regards, Hans Vogelaar (https://www.eileenslounge.com)

    Tuesday, November 17, 2020 12:45 PM
  • Hans,

    you call a method for the Application object. My inquiry is about a built-in dialog though.

    Please note that your CompareDocuments method does not allow users to setup required configuration at runtime and that's where my request stems from. 

    Frankie


    Wednesday, November 18, 2020 5:30 AM
  • See Built-in Dialog Box Argument Lists (Word)

    The arguments of the wdDialogToolsCompareDocuments dialog are CompareDestination , DetectFormatting, IgnoreCompareWarn, UseFormatFrom, AddToMru, Merge, FilterPrivacy, FilterDateAndTime, Name, CompareAuthor. I don't see a way to specify the documents.


    Regards, Hans Vogelaar (https://www.eileenslounge.com)

    Wednesday, November 18, 2020 8:14 AM
  • Hans, Thanks for the update.

    Sounds strange the two major properties are somewhat hidden from users, right?

    Anyways, may I ask you to clarify where did you get the info you provided? I took me a while before I found out that the "Formatting" property is actually named "DetectFormatting". I had to experiment for half a day before I got luck.

    Many thanks,
    Frankie 



    Wednesday, November 18, 2020 8:22 AM
  • I searched Google for word vba built-in dialog arguments and found the link you see in my previous reply.

    Regards, Hans Vogelaar (https://www.eileenslounge.com)

    Wednesday, November 18, 2020 9:13 AM
  • Hans,

    do you think you could redirect me to an MVP who might know where to look for relevant Microsoft documentation?

    Many thanks,

    Frankie


    • Edited by FrantikDvojka Monday, December 21, 2020 9:29 AM changing signature
    Monday, December 21, 2020 9:23 AM
  • I'm sorry, I can't, but let's hope Word MVPs read this thread.

    Regards, Hans Vogelaar (https://www.eileenslounge.com)

    Monday, December 21, 2020 12:17 PM