I have inserted large wordpad file into word document. While inserting, the
nice looking justified paragraph becomes unruly, and lines appear broken.
How can we create a macro that will start from top and shall repeat the
following functions:
1. go to end of line, delete extra spaces in between lines, and repeat
same if still
there is space left in the line
2. go to next line, repeat same process until end of paragraph is reached.
3. continue till end of document, or till a specified point and make the
entire text,
so far adjusted, as justified.
thanks in advance
Jean-Guy Marcil - 22 Dec 2004 14:33 GMT
hsg was telling us:
hsg nous racontait que :
> I have inserted large wordpad file into word document. While
> inserting, the nice looking justified paragraph becomes unruly, and
[quoted text clipped - 11 lines]
> the entire text,
> so far adjusted, as justified.
Try this:
'_______________________________________
Dim DocRange As Range
Set DocRange = ActiveDocument.Range
With DocRange.Find
.Forward = True
.ClearFormatting
.Wrap = wdFindContinue
Do
.Execute FindText:=" ", Wrap:=wdFindContinue, _
ReplaceWith:=" ", Replace:=wdReplaceAll
Loop While .Found = True
End With
DocRange.ParagraphFormat.Alignment = wdAlignParagraphJustify
'_______________________________________
Use
Set DocRange = 'Some Range
to target specific parts of a document.

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org