Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2004

Tip: Looking for answers? Try searching our database.

how to align text in paragraph form?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
hsg - 22 Dec 2004 13:43 GMT
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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.