web development India freelance website designer
This code will take a searchstring and a textbox, search the textbox, when the word is found, it will
highlight it. This is probably how MS Word works. Put this code into a reusable module.

EXAMPLE--searchHighlight(text1,"search")

Public Function searchHighlight(srchTextBox As textBox, srchString As String)
'on error resume next
Dim A As Integer
Call srchTextBox.SetFocus
SendKeys ("^{HOME}")
A = 1
Do Until A = Len(srchTextBox.text)
'if word was found...
If Mid(UCase$(srchTextBox.text), A, Len(srchString)) = UCase$(srchString) Then
'highlight the word
For A = 1 To Len(srchString)
SendKeys ("+{RIGHT}")
Next A
Exit Do
End If
'if word isnt found or a return is found, dont do anything
If Mid(srchTextBox.text, A, 1) = Chr$(13) Then
Else
'go to next line
SendKeys ("{RIGHT}")
End If
A = A + 1
If A > Len(srchTextBox.text) Then Exit Do
Loop
End Function
Search and highlight a string in a textbox

1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550

Freelance ASP PHP web development | Web developer India Web development India| Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design