Add or Insert Paragraphs in Word VBA

Add or Insert Paragraphs in Word VBA

Pragraphs.Add

Microsoft provides Paragraphs collection which helps developer to add new paragraph in a Word Document. Below example shows how to add new paragraph in Word Document.

Code example

Public Sub AddOrInsertParagraph()
	On Error GoTo errh

	'This will insert new paragraph at current selection in Word Docuemnt
	ThisDocument.Paragraphs.Add
	
	'Handle error here
	errh:
		If Err.Number <> 0 Then
			MsgBox "There is an erro while adding paragraph : " & Err.Description
		End If
End Sub

Next Remove Space Before Paragraph

Leave a Reply

Your email address will not be published.