Find a term/word, jump to end of line, enter 4 returns RRS feed

  • Question

  • I am trying to write the code to go through a WORD document, find the term EMAIL:, then goto the end of that same line where there is a hard return and insert 4 more hard returns.
    Monday, April 1, 2019 9:06 PM

All replies

  • Here you go:

    Sub AddReturns()
        With ActiveDocument.Content.Find
            .Text = "(EMAIL:*^13)"
            .Replacement.Text = "\1^p^p^p^p"
            .MatchWildcards = True
            .Execute Replace:=wdReplaceAll
        End With
    End Sub

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Monday, April 1, 2019 9:17 PM
  • Thanks!  I see where my thinking was wrong in what I was attempting.  This works perfectly.
    Tuesday, April 2, 2019 5:04 AM