Dim strSource As String = wb.DocumentText.ToString
Dim intPos As Integer = Strings.InStr(strSource, "</title>", CompareMethod.Text)
If intPos <> 0 Then
Dim strTempSource As String = String.Empty
strTempSource = Strings.Mid(strSource, 1, intPos - 1) & "</title><script language='JavaScript'>function SelectText(pValue) {var r = document.body.createTextRange(); var t = r.findText(pValue); if (t == true) {r.select();} return t;}</script>" & Strings.Mid(strSource, intPos + 8, Strings.Len(strSource)) '+ 8 is length of text </title>.
wb.Document.Write(strTempSource)
Dim Cnt As Integer = UBound(arrFind) + 1
Dim i As Integer
For i = 1 To Cnt
Dim arrObj(0) As Object
Dim bolSuccess As Boolean
arrObj(0) = CObj(New String(arrFind(i - 1).ToString))
With wb.Document
bolSuccess = .InvokeScript("SelectText", arrObj)
If bolSuccess = True Then
.ExecCommand("ForeColor", False, "#FF0000")
.ExecCommand("BackColor", False, "#FFFF00")
.ExecCommand("Unselect", False, Nothing)
End If
End With
Next
End If