Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Removing extra spaces from a String in WD 97

    Hello,

    I posted this question a few days ago, but I used the wrong version information. The solutions I received all worked beautifuly in Word 2000, but when I tried them in Word 97, they blew up. So, here we go again.

    I am looking for a function that will strip out extra spaces in group of words. I am collecting name and address information with a userform and I want to make sure that, if the user types extra spaces between the names, the name is displayed correctly on the final document.

    Example1: If the user types "Joe_____Blow" it should appear as "Joe Blow"
    Example 2: user types "Mr._____and Mrs. Larry_____Tate___III" should appear as "Mr. and Mrs. Larry Tate III"
    Note: The underscore marks represent blank spaces.

    If anyone has a function or some code that can accomplish this, it will be greatly appreciated.

    Thanks,

  2. #2
    whomper
    Guest

    Re: Removing extra spaces from a String in WD 97

    i always was able to do a replace xx with x
    and keep repeating the replace
    until they were gone

    then i go back and replace .x with .xx to fix the sentence spacing


    what is it that fails with your replace command?
    there must be something different about your options that is affecting it

  3. #3
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Silicon Valley, California, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Removing extra spaces from a String in WD 97

    If you select the text you are interested in modifying, then choose Edit (menu), Replace..., click More to see more options, then choose "White Space" from the Special drop-down, you should see "^w" in the "Find what:" field. Then in the "Replace with:" field, type a single space. Click Replace All. This will save you the hassle of having to repeat the search a few times when replacing two spaces with one space.

    Also, you can type the "^w" manually, if you don't like mousing any more than you have to.

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Removing extra spaces from a String in WD 97

    Mark, the <A target="_blank" HREF=http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Cat=&Board=wrd&Number=88215>WildRe place() function</A> should not require anything in Word2000, but it does require VBScript 5.0 or highter (installed by IE 5.0 or higher). If it's not working on Word 97 with IE 5, can you tell me where the macro stops working?

Posting Permissions

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