# Word line lengths in MS Word 2010



## rdBent (Oct 25, 2010)

How can I change the word line lengths in Word 2010? I sometimes copy and paste plain text into word documents and the line word lengths turn out to be too short (don't fill the whole page). Fixing this line by line with the delete key is painful.


----------



## rdBent (Oct 25, 2010)

*Word 2010 line length*

Here's the macro I wrote in 2005 to close up paragraphs with short lines. (The instructions are a little simpler for Word 2010. ) It worked for Word 2007, but I can't get it to work for Word 2010. When I highlight the paragraph I want to close up and click on "Run," the paragraph is replaced by the following instructions, not by the results of carrying out those instructions. I think the error is not in the code but in how I'm using Windows 7.

*Macro for closing up paragraphs in WORD*​ *5-3-05*​ 
^p = WORD character for a line hard right.
^p^p = WORD characters for two hard rights to separate paragraphs.

*Create a macro to delete line hard-rights but preserve paragraph separation. *


Make a WORD text file to which the following commands are to be applied.
Highlight text.
Tools – macro – record new macro
Name: bobjustify
Store: all documents à record mode (tape cassette icon)
 Every key stroke will be recorded.


Find ^p^p
 Replace WWWW
Replace all
Remainder of document? No


Find ^p
 Replace: (blank space to eliminates both line hard-rights and 

paragraph separation) 
Replace all
No


Find WWWW
 Replace ^p^p (restores paragraph separation)
Replace all
No 


Close (still in record mode)
Tools – macro – stop recording
Don’t know where this macro is stored.
 
*Test Run*


Open WORD file
Highlight paragraphs to be closed up.
<alt>F8 (shortcut for Tools – macro – macros)
Name: bobjustify (automatic if there is not a list; otherwise select this).
Run
Answer questions: No, No, No
Click on document to eliminate the highlighting.


----------



## macropod (Apr 11, 2008)

Hi rdBent,

Undoubtedly, the short lines lengths are because whatever you've pasted has manual line breaks or paragraph breaks at the end of the lines. If you could tell us which they are, together with how many paragraph breaks are used to separate logical paragraphs, an easy solution could probably be provided, using Find/Replace.


----------



## macropod (Apr 11, 2008)

Hi rdBent,

That's not the macro - it's just the steps you went through to create one. For some basics, see:
http://word.mvps.org/FAQs/MacrosVBA/VBABasicsIn15Mins.htm
and
http://word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm

Then, to see 'where the macro went', press Alt-F11 to open the VBE (Visual Basic Editor) and look in the modules.


Once you've done that, try something along the lines of the following macro:

```
Sub Cleanup()
With Selection.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = True
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Text = "[^13^11]"
    .Replacement.Text = "^182"
    .Execute Replace:=wdReplaceAll
    .Text = "[^182]{2,}"
    .Replacement.Text = "^p"
    .Execute Replace:=wdReplaceAll
    .Text = "^182"
    .Replacement.Text = " "
    .Execute Replace:=wdReplaceAll
End With
End Sub
```


----------

