• Removing extra spaces from a String in WD 97

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Removing extra spaces from a String in WD 97

    Author
    Topic
    #362430

    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,

    Viewing 1 reply thread
    Author
    Replies
    • #550338

      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.

    • #550354

      Mark, the WildReplace() function 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?

    Viewing 1 reply thread
    Reply To: Removing extra spaces from a String in WD 97

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: