Select a range of text in Microsoft Word

I am trying to replace some text in a Microsoft Word document within a specific paragraph.
How do I actually select the whole paragraph so I can replace the characters at the end of it?

I have no clue as I have seen this is not so simple.

Thanks!

How are you selecting the paragraph where you want to make replacements?

Is it the paragraph where the current insertion point is located? What if the selection spans multiple paragraphs?

Or is it a specific paragraph within a document, perhaps identified by index or something?

Or is it a paragraph where particular text can be found?

Here’s how to select entire paragraph of the current selection, including multiple paragraphs should the selection span more than one.

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

tell application "Microsoft Word"
	
	set firstPP to first paragraph of selection
	set lastPP to last paragraph of selection
	
	tell active document
		
		set ppRange to ¬
			create range start (start of content of text object of firstPP) ¬
				end (end of content of text object of lastPP)
		
		select ppRange
		
	end tell
	
end tell

Thanks roosterboy.

What you shared may get me started. But I would like to take the text of a whole paragraph where a particular text can be found and replace a few characters (page numbers in a TOC, basically).

So after getting the range of selected paragraphs, I would like to select specific paragraphs based on what their first words are then change the page numbers at the end of the paragraphs.

Essentially I need to get the whole paragraph text, not just the reference, into a container I can then manipulate and then place back in.