Using a loop to search and insert line brakes

P

Paul

I want to search a document for a specific string and then
insert a line break in front of it. I have figured out
the code to do the search and insert but I can't figure
out how to loop the find to search the entire document.

Thanks.
 
S

Steve Lang

Hi Paul,

With Selection.Find
.Text = "Hi"
.Forward = True
'add other search criteria before the execute statement if needed
.Execute
Do While .Found
'do something here to the found text
.Execute 'does the find process again
Loop
End With



HTH and have a great day!

Steve
 

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