find first empty line

G

GUS

i want a macro to search in a documend and when finds the first empty line
then select and copy the text above the empty line till the begining of the
document.

for example.

<
bla bla bla bla bla bla bla bla bla bla bl
bla bla bla bla bla bla
bla bla bla bla bla bla bla bla

uuuuuu uuu ttttt wwwwww fff
mmmmmm mmmmmm mmmmm
text text text ggggg gggggg gggg
etc.
lets say that we have the above text .The macro must finds the empty line
and then select and copy all the paragraph with (bla bla bla)
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Use

Dim myrange As Range
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^p^p"
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = False
End With
Selection.Find.Execute
Set myrange = Selection.Range
myrange.Start = ActiveDocument.Range.Start
myrange.Copy


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top