+ Reply to Thread
Results 1 to 9 of 9

Replace Random Chinese Words (Not Characters) with Blank Spaces in MS Word

  1. #1
    Registered User
    Join Date
    06-14-2011
    Location
    Denver, Colorado
    MS-Off Ver
    Excel 2003
    Posts
    81

    Replace Random Chinese Words (Not Characters) with Blank Spaces in MS Word

    Hello,

    I wrote a macro that successfully chooses ten random characters from my document, not including punctuation marks, deletes them, and replaces them with blank spaces-- to make a fill-in-the-blank worksheet. I don't have the code with me now as I'm not at my home pc.

    What I'd like to make it do is to choose ten random WORDS not characters and replace them with blanks. I don't know if I would have to install a Word Chinese language pack for this? Is Chinese MS Word able to detect full words or only characters?

    Another similar starting question would be if I had a document full of English words but all running together, no spaces in between, similar to the way Chinese documents are, then would there be a way to detect the words and make splits between them so that you have the spaces necessary to make a macro to delete a random ten words and replace them with blanks?

    Or is MS Word simply not smart enough to detect words if there are no spaces between them? And if that's the case, any ideas on how to make a macro, which when turned on, would allow me to create spaces between words with only one click of the cursor at the desired location so as to save time wasted on click+spacebar?

    Thank you for all ideas!
    Last edited by mlexcelhelpforum; 08-05-2012 at 04:55 AM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Replace Random Chinese Words (Not Characters) with Blank Spaces in MS Word

    word?,why have you posted in excel /general?
    http://www.excelforum.com/word-formatting-and-general/
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Replace Random Chinese Words (Not Characters) with Blank Spaces in MS Word

    @martin
    Thanks for the reminder re the wrong forum.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    06-14-2011
    Location
    Denver, Colorado
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Replace Random Chinese Words (Not Characters) with Blank Spaces in MS Word

    Ok, didn't know where that was. Have reposted.

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Replace Random Chinese Words (Not Characters) with Blank Spaces in MS Word

    mlexcelhelpforum

    There was no need to repost. This thread has been moved to the correct forum. I will now delete your duplicate post.

  6. #6
    Registered User
    Join Date
    06-14-2011
    Location
    Denver, Colorado
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Replace Random Chinese Words (Not Characters) with Blank Spaces in MS Word

    Oh, thanks! Would you mind giving me the new direct link? Can't seem to find it.

    ---------- Post added at 12:07 PM ---------- Previous post was at 12:06 PM ----------

    Oh! It's already there, sorry. I was eagerly awaiting responses.

  7. #7
    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: Replace Random Chinese Words (Not Characters) with Blank Spaces in MS Word

    MS Word cannot detect individual words when the strings have no spaces. If you know what your word is, MS Word can find substrings within the larger string that match your word, but whether that would be a proper word identification in context is another matter entirely.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  8. #8
    Registered User
    Join Date
    06-14-2011
    Location
    Denver, Colorado
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Replace Random Chinese Words (Not Characters) with Blank Spaces in MS Word

    Hi! Well I figured out a way to get spaces between the Chinese words by pasting from an online translator. So now the question is: How would I rewrite this macro to work for words (delimited by spaces) instead of just characters?

    Please Login or Register  to view this content.


    ---------- Post added at 03:15 AM ---------- Previous post was at 03:13 AM ----------

    P.S. Some of those Else if texts, such as "£©" are really jarbled. My original code only excepts all basic punctuation symbols, but posted here it ends up looking weird like that.

    ---------- Post added at 03:53 AM ---------- Previous post was at 03:15 AM ----------

    Well, I just switched "Characters" to "Words" and now it works .

  9. #9
    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: Replace Random Chinese Words (Not Characters) with Blank Spaces in MS Word

    If I understand your code correctly, it could be made more efficient and reduced to:
    Please Login or Register  to view this content.
    For words, simply change "Characters" to "Words".

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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