PDA

View Full Version : Add a new paragraph after for each selected paragraph



smallxyz
07-25-2016, 05:17 AM
Hi,

Suppose there are 3 paragraphs:

*********
******
******************

After highlighting them, the VBA would return :

*********

******

******************

Below is my attempted code, but it return infinite parapraphs.


Private Sub cmdLnBr_Click() Dim P As Paragraph
Application.ScreenUpdating = False
For Each P In Selection.Paragraphs
P.Range.InsertParagraphAfter
Next
Unload Me
End Sub

How should I amend it?
Thanks.

gmayor
07-25-2016, 09:44 PM
See answer in duplicated thread at http://www.vbaexpress.com/forum/showthread.php?56684-Add-a-new-paragraph-after-for-each-selected-paragraph