none
comparing paragraph in multiple word documents to identify the possible variables RRS feed

  • Question

  • I have approximately 278 html files in a folder that will be changed to merge documents.  I have been doing this manually, opening each html file, removing residual graphics, correcting formatting errors where applicable, then reading through each document to find the paragraphs with changes.  I have searched the internet for a macro to speed  up the process but found none.  So, I am asking someone to create one or two for me? 

    I can record and run a basic macro using any version of word but cannot write one. So, if you can please create the entire code and include instructions on how to run it. 

    Thanks so very much for your help.

    the macro, should

    prompt me to select the folder with the html files

    prompt me to select the folder to save the converted word (.docx) files

    after all the files and converted and saved to the word folder

    open each of the converted word files and allow me to run my clean up macros

    so I guess I would need another message box prompt (click ok when complete).

    then close and save each (back to the same folder)

    after all the clean up is completed, the macro should:

    Open the first document and the second document

    compare each paragraph of the first document to each paragraph of the second document.

    ignore tables graphic and empty lines.

    If a match is found, change the color of the unique text in that paragraph dark red then move to the next paragraph of the first document and begin comparing against the first paragraph of the second document.

    if no match is found, then compare the paragraph in the first document to the next paragraph in the second document

    continue to the end of the second document then compare the next paragraph to the firs paragraph in document

    save the compared documents with a new name that combines the name of the compared file in a new folder (prompts to select the folder and continues on ok)

    continue until there is no more files in the files in the original folder.

    the macro is treating each paragraph as separate document and comparing as with the document compare feature in word.

    comparing example:

    Document 1lamb

    Document2 dog

    Paragraph 1 Mary had a little lamb its fleece was white as snow. And everywhere   that Mary went the lamb was sure to go.    Lovely day.

    Paragraph 1 the quick brown fox jumped over the lazy dog.  The dog did not look at the quick brown   fox.

    Paragraph 2. The nimble brown fox jumbled over the tired dog.  The dog got a piece of the quick brown fox   tail.

    A twister of twist once twisted a twist and the twist that he twisted   was a three twisted twist. Now in twisting that twist if one twist were to   untwist, it would untwist the three twisted twist that the twister of twist   had twitted.

    The compared document would look like:

    Document lambdog

    Paragraph 1

     Mary had a little lamb its   fleece was white as snow. And everywhere that Mary went the lamb was sure to   go.  Lovely day.

    Paragraph 2.

    The nimble brown fox jumbled over   the tired dog.  The dog got a   piece of the quick brown fox tail.

    Friday, November 27, 2015 3:22 AM

All replies

  • Hi,

    This is the forum to discuss questions and feedback for Microsoft Word, the issue is more related to Word coding/programing, you'd better post your question to the MSDN forum for Word

    http://social.msdn.microsoft.com/Forums/en-US/home?forum=worddev&filter=alltypes&sort=lastpostdesc

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    George Zhao
    TechNet Community Support


    Please mark the reply as an answer if you find it is helpful.

    If you have feedback for TechNet Support, contact tnmff@microsoft.com.
    Monday, November 30, 2015 2:36 AM
  • Hi Laulou

    These forums are for helping you with problems you have when programming Word. They're not a service for writing free code. The people who help out here get paid for that. There are plenty of code samples out there on the Internet that perform the individual steps you ask about. You need to make the time and put in the effort to do as much work as you can, then ask about specific issues that are blocking your progress. Or you need to pay someone to do the work for you.


    Cindy Meister, Office Developer/Word MVP, <a href="http://blogs.msmvps.com/wordmeister"> my blog</a>

    • Proposed as answer by ryguy72 Thursday, January 7, 2016 4:17 AM
    Monday, November 30, 2015 2:58 PM
    Moderator