none
Reformat paragraph (part 2) RRS feed

  • Question

  • I didn't phrase my question correctly last time, so I want to try again.  Here goes....

    In Word 2010, if I select of block of text, such as a paragraph, how can I "reformat" that paragraph?  The block of text that is selected contains text with multiple whitespace characters between words.   The reformat operation should leave only one whitespace between words, essentially cleaning up the paragraph, or making the paragraph look nicer.

    Do I need to use VBA for this?  Or does Word have a built in function or command that does this?

    Thanks.


    jmmc

    Saturday, May 25, 2013 11:01 AM

Answers

  • Select the text.

    Press Ctrl+H to activate the Replace dialog.

    Enter   ^w   in the 'Find what' box. This code stands for 'whitespace of any length'.

    Enter a single space in the 'Replace with' box.

    Click the 'Replace All' button.


    Regards, Hans Vogelaar

    Saturday, May 25, 2013 11:57 AM
  • For the vba code, simply record the Find/Replace operation as a macro. In this case, the code the macro recorder produces is essentially the same as a hand-crafted one.

    Cheers
    Paul Edstein
    [MS MVP - Word]

    Sunday, May 26, 2013 6:43 AM

All replies

  • Select the text.

    Press Ctrl+H to activate the Replace dialog.

    Enter   ^w   in the 'Find what' box. This code stands for 'whitespace of any length'.

    Enter a single space in the 'Replace with' box.

    Click the 'Replace All' button.


    Regards, Hans Vogelaar

    Saturday, May 25, 2013 11:57 AM
  • Select the text.

    Press Ctrl+H to activate the Replace dialog.

    Enter   ^w   in the 'Find what' box. This code stands for 'whitespace of any length'.

    Enter a single space in the 'Replace with' box.

    Click the 'Replace All' button.


    Regards, Hans Vogelaar

    Thanks Hans, that worked nicely!  8)

    Suppose I want to install a  VBA macro that completes the above task with a Ctrl key combination press. What would the VBA code look like?  I just want to simplify or quickly automate the above task, because I know most people are too lazy to follow the above procedure.

    I'd appreciate any ideas for the VBA code.   Thanks.


    jmmc

    Saturday, May 25, 2013 10:47 PM
  • For the vba code, simply record the Find/Replace operation as a macro. In this case, the code the macro recorder produces is essentially the same as a hand-crafted one.

    Cheers
    Paul Edstein
    [MS MVP - Word]

    Sunday, May 26, 2013 6:43 AM