+ Reply to Thread
Results 1 to 2 of 2

VBA: Find and Replace several thousand words and numbers

  1. #1
    Registered User
    Join Date
    12-13-2022
    Location
    Praha, Czech Republic
    MS-Off Ver
    365
    Posts
    1

    VBA: Find and Replace several thousand words and numbers

    Hello,

    I'm a bit experienced in Excel VBA but not in Word VBA.

    I have a long text of several thousand pages and within this text I have to replace several thousand different words and numbers. To give you an example:

    Left is the word or number that needs to be replaced, right is the replacement.

    Example of a replacement table with 6 rows:


    Replace, Replacement
    " funy ", " funny "
    " helb ", " help "
    " helb:", " help:"
    " helb.", " help."
    "i234", "1234"
    " 1234 ", " No:1234 "

    In reality, the replacement table has a few thousand rows.

    It is possible to copy the above, line by line in the VBA code as follows:

    funy ; funny
    helb ; help
    helb:; help:
    helb.; help.
    i234;1234
    1234 ; No:1234


    The semicolon ";" as separator.

    And when I run the VBA macro it starts replacing all the words.

    Just a simple solution would be great.



    P.S. I gave you this example:

    "i234", "1234"
    " 1234 ", " No:1234 "

    The Text "My bonny has i234 US-Dollars"
    a) first becomes "My bonny has 1234 US-Dollars"
    b) and finally becomes "My bonny has No:1234 US-Dollars"

    I don't care if the final solution is a) or b).

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: VBA: Find and Replace several thousand words and numbers

    For example:
    Please Login or Register  to view this content.
    Simply replace 'WordListFullName' with the path and filename of the document containing your Find/Replace list.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replace words by numbers and calculate mean II
    By anahochmanova in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-15-2019, 06:12 PM
  2. [SOLVED] Replace words by numbers and calculate mean
    By anahochmanova in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-15-2019, 05:30 PM
  3. Find and replace parts in string with words, numbers from a table
    By moosmahna in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-26-2017, 11:54 AM
  4. Replies: 3
    Last Post: 11-25-2014, 06:08 AM
  5. Replies: 4
    Last Post: 04-27-2012, 06:38 AM
  6. Excel 2007 : replace words with numbers
    By gomes. in forum Excel General
    Replies: 11
    Last Post: 03-02-2010, 02:22 PM
  7. Replies: 1
    Last Post: 09-14-2005, 04:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1