How can I find the total number of line in a text node? In the code below, I am scanning the first line on a textnode and if the text matches, it is added to the display set. But what if the text is on the third line or fourth line? Specifying a line number works but it comes up with an error for any textnode that doesnt have the same number of lines. For example if I am looking for the third line of a textnode and the textnode the enumerator is scanning an element that has only two lines, the program gives an error. Not having the functionally of a complex element, how do I create an array or a 'for' statement to loop through the lines?
Thank you
oScan.ExcludeAllTypes
oScan.IncludeType msdElementTypeTextNode
For Each oAttachment In ActiveModelReference.Attachments
Set oEnum = oAttachment.Scan(oScan)
While oEnum.MoveNext
With oEnum.Current
If .Type = msdElementTypeTextNode Then
Set oElem = oEnum.Current
textvalue2 = oElem.AsTextNodeElement.TextLine(1)
If InStr(textvalue2, textstring) <> 0 Then
oElem.InDisplaySet = True
End If
End If
End With
Wend
Next