1. marcusl

    marcusl New Member

    Joined:
    Aug 1, 2009
    Messages:
    98
    Likes Received:
    0

    Search and replace across multiple Word documents

    Discussion in 'Writing Software and Hardware' started by marcusl, Sep 14, 2010.

    Does anyone know of a program that allows you to perform a search and replace across multiple Word (.doc) documents? I've found some software that performs this function for .txt files, but it corrupts .doc files.

    Thanks people.
     
  2. SashaMerideth

    SashaMerideth Active Member

    Joined:
    Aug 26, 2010
    Messages:
    309
    Likes Received:
    9
    Location:
    California
    I asked one of my geeky friends about this, and after a five minute lecture about "open formats" and such, the suggestion was to save as RTF and use something like Notepad++ to do a search and replace across all opened documents.
     
  3. Thanshin

    Thanshin Active Member

    Joined:
    Jun 1, 2010
    Messages:
    562
    Likes Received:
    13
    Location:
    Spain
    This looks harder than it is. Try each step and you'll probably understand the underlying pattern.

    1 - Start saving a macro in the first document. Choose a hotkey.
    2 - Do your replace.
    3 - Go to a different document.
    4 - Stop saving the macro.
    5 - Edit the macro (in VB). Even without a programming background you should be able to understand the two commands that are in the macro: the replace and the document switch.
    6 - Copy both commands, paste them once for each document you want to run the replace on.
    7 - Change the file name on the change document command.
    8 - Run the macro with your hotkey.
     
  4. Melzaar the Almighty

    Melzaar the Almighty Contributor Contributor

    Joined:
    Aug 28, 2010
    Messages:
    1,789
    Likes Received:
    55
    Location:
    UK
    Unless you have, like, 500 documents, it really shouldn't be that much bother. Ctrl F, the find should be saved in the history, hit the "replace" button, next document, Ctrl F, etc... By the time you've done six or seven you'd be ahead of the macro-making steps in clicking on things efficiency, and I don't really want to believe you're dealing with a million word documents because that might make my head explode. :p
     
  5. Thanshin

    Thanshin Active Member

    Joined:
    Jun 1, 2010
    Messages:
    562
    Likes Received:
    13
    Location:
    Spain
    But my method leaves behind a macro that can be modified in seconds to do any other future replacement.
     
  6. Melzaar the Almighty

    Melzaar the Almighty Contributor Contributor

    Joined:
    Aug 28, 2010
    Messages:
    1,789
    Likes Received:
    55
    Location:
    UK
    Maybe I am just failing to imagine a scenario where you'd need it. :p
     
  7. minstrel

    minstrel Leader of the Insquirrelgency Supporter Contributor

    Joined:
    Jul 11, 2010
    Messages:
    10,742
    Likes Received:
    9,991
    Location:
    Near Sedro Woolley, Washington
    Maybe you have a different file for each chapter of a novel, and you want to change a character's name, and the name appears in all chapters.
     
  8. Horizon Noise

    Horizon Noise New Member

    Joined:
    Sep 12, 2010
    Messages:
    86
    Likes Received:
    0
    Why do you have a different document for each chapter? I would have thought that makes cohesion rather difficult, especially when you need to shift stuff around.
     
  9. Melzaar the Almighty

    Melzaar the Almighty Contributor Contributor

    Joined:
    Aug 28, 2010
    Messages:
    1,789
    Likes Received:
    55
    Location:
    UK
    The thought makes my brain hurt. :p The only reason I'd do that was if my document was hanging the computer if the whole thing was too big, and even then I'd rather just write in Notepad than break things up.
     
  10. mammamaia

    mammamaia nit-picker-in-chief Contributor

    Joined:
    Nov 21, 2006
    Messages:
    19,150
    Likes Received:
    1,034
    Location:
    Coquille, Oregon
    in which case, at some point, you'd have to put them all into one file, to create the ms needed for submitting, so why not just do it and make changing stuff easier?
     
  11. Cogito

    Cogito Former Mod, Retired Supporter Contributor

    Joined:
    May 19, 2007
    Messages:
    36,161
    Likes Received:
    2,828
    Location:
    Massachusetts, USA
    You can also create a master document to contain the other documents as subdocuments. Look up master documents and subdocuments in Word help or on the Microsoft website.

    You can search and replace in the master document and all the subdocuments will receive the benefit.
     
  12. Thanshin

    Thanshin Active Member

    Joined:
    Jun 1, 2010
    Messages:
    562
    Likes Received:
    13
    Location:
    Spain
    I don't really know the technological level of the latest Word but I'd be surprised if you couldn't hotlink (paste by reference, or however you call that) all the documents in an empty "canvas" document.

    That would allow you to make changes in all at the same time and also would keep them separated.
     
  13. thewordsmith

    thewordsmith Contributor Contributor

    Joined:
    Nov 18, 2009
    Messages:
    868
    Likes Received:
    125
    Location:
    State of Confusion
    Odd you should mention that ...
    I actually do have a manuscript with each chapter a different document. Each chapter is also a short story in its own right as well as a part of the overall body of work. But, even at that, I shouldn't think it would be too much of a problem to do a global search & destroy function (okay ... find and change :rolleyes: )
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice