Results 1 to 2 of 2

Thread: Find&Replace in Word!

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Posts
    1

    Find&Replace in Word!

    Hi,

    if have a problem. I tried to create macro in word, which find should words in the text, by scanning a a excel sheet( only one column).
    If there is match, it should be replaced by a Word/Value of the same excelsheet just another column, but same row.

    It would be great, if someone can help me.

    The excelsheet looks like:

    1. Column 2. Column
    Contact.N Contact.M

    Best Regards & Thanks for any response.
    Frantic

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Find&Replace in Word!

    Open the excel sheet (in and excel object, visibility false).
    Find the bottom most data line.
    Start a loop from the top to that number.
    grab the 'find' and 'replace with' from the spreadsheet into a variable each
    Code:
    activedocument.range = replace(activedocument.range,strFind,strReplaceWith)
    Keep looping until complete.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width