Inserting Paragraphs
You can use any of the following methods to add new paragraphs to a document:
Add Method
Adds a new paragraph before the first paragraph in the current selection
ActiveWindow.Selection.Paragraphs.Add Range:=ActiveWindow.Selection.Paragraphs(1).Range
InsertParagraph
This replaces the specified range or selection with a new paragraph.
If you do not want to replace the range or selection you should collapse the range or selection first.
Set objRange = ActiveWindow.Selection.Paragraphs(1).Range.InsertParagraph
This is equivalent to the following:
Set objRange = ActiveWindow.Selection.Paragraphs(1).Range
objRange.InsertParagraph
After this method has been called the objRange object represents the new paragraph.
This inserts a new paragraph at the beginning of the active document
Set objRange = ActiveDocument.Range(Start:=0, End:=0)
objRange.InsertParagraph
InsertParagraphAfter
This inserts a new paragraph after the specified range or selection
After this method has been called the specified range or selection is expanded to include the new paragraph.
ActiveWindow.Selection.InsertParagraphAfter
ActiveWindow.Selection.Paragraphs(1).Range.InsertParagraphAfter
This inserts a paragraph at the end of the active document
ActiveDocument.Content.InsertParagraphAfter
InsertParagraphBefore
This inserts a new paragraph before the specified range or selection
ActiveWindow.Selection.Paragraphs(1).Range.InsertParagraphBefore
This line is identical to the following line
ActiveWindow.Selection.Paragraphs.Add Range:=ActiveWindow.Selection.Paragraphs(1).Range
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext