Replace tab with break

  • Thread starter Francis Hookham
  • Start date
F

Francis Hookham

Please help me find the third Tab Character in each paragraph and replace it
with a Manual Line Break.

NB I might need to change to second or fourth Tab Character.

Francis Hookham
(I thought I had posted this request but I cannot find it - please excuse me
if this IS the second request)
 
J

Jean-Guy Marcil

Francis Hookham was telling us:
Francis Hookham nous racontait que :
Please help me find the third Tab Character in each paragraph and
replace it with a Manual Line Break.

NB I might need to change to second or fourth Tab Character.

Francis Hookham
(I thought I had posted this request but I cannot find it - please
excuse me if this IS the second request)

Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "(*^t*^t*)(^t)(*^13)"
.MatchWildcards = True
.Wrap = wdFindContinue
.Forward = True
.Replacement.Text = "\1^l\3"
.Execute Replace:=wdReplaceAll
End With

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
K

Klaus Linke

Please help me find the third Tab Character in each paragraph and replace
Jean-Guy Marcil said:
.Text = "(*^t*^t*)(^t)(*^13)"
.Replacement.Text = "\1^l\3"


Hi Jean-Guy,

Very nice pattern! It took me a while to see why this expression always
works, and it's really not easy to find something that works both for
paragraphs that start with text, and with a tab.

.Text = "(*^t*^t*)(^t)(*^13)"
does the trick because the pattern matching stops each tentative match
(whether successful or not) when it encounters a ^13, and then starts anew
right after each paragraph mark.

Regards,
Klaus
 

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