Forum Discussion

dorapop's avatar
dorapop
Copper Contributor
Dec 23, 2021

insering the same text at the end of every paragrapg in a word doc

Hello,

I want to add a small  sentence at the end of all paragraphs in a word text . Is there an automatic way to do it? maybe with autotext? 

2 Replies

  • dorapop 

     

    Use a macro containing the following code

     

    Dim i As Long
    Dim rng As Range
    With ActiveDocument
         For i = 1 To .Paragraphs.Count
               Set rng = .Paragraphs(i).Range
               rng.End = rng.End - 1
               rng.InsertAfter " Some new text."
         Next i
    End With

    • dorap305's avatar
      dorap305
      Copper Contributor
      @DagMVP thank you so much! I will try it right away.

Resources