As a final follow-up to this question, I found:
Code:
Dim rng As MSHTML.IHTMLTxtRange
Dim rngElement As MSHTML.HTMLDDElement
Set rng = Doc.Selection.createRange
Set rngElement = rng.parentElement
With rngElement
'Determine the ID for the selected elements
strStyleID = "StyleID" & Int((100000 * Rnd) + 1) ' Create a Random ID value
If rng.HtmlText = "" Then
' Provide an ID, class and fonts etc for the single selected paragraph.
.ID = strStyleID assign the ID to the paragraph.
Else
' loop through each instance of an ID if found to allow for the change.
Start = 1 Do
FoundPos = InStr(Start, rng.HtmlText, "<P ID=", vbTextCompare) ' Find the start position of the ID within the selected text
If FoundPos > 0 Then
EndPos = InStr(FoundPos + 3, rng.HtmlText, " ", vbTextCompare) ' Find the end position of the ID
strStyleID = Mid(rng.HtmlText, FoundPos + 6, EndPos - FoundPos - 6) ' Return Style ID
strLiText = .innerText
With Doc.getElementById(strStyleID)
' .... etc... etc....
End with
End if
In this way, I can select all the required paragraphs I want, and apply the class to each one where the ID is found.
It's messy and I hate it, but it works for lack of a cleans mean to identify the selected paragraphs. I'm sure I can find a cleaner solution, but this works for now.
All that needs happen to to provide an ID whenever a paragraph is created to avoid unnecessary steps.
Thanks for help