| Find Text |
|
|
|
| Tutorials | |
|
In word you can use the function below to search for a specific text. This particulair function has a option to choose if the search is case sensitive or not.
1 Function FindText(ByVal searchStr As String, Optional ByVal doMatchcase As Boolean = False) As Boolean 2 3 '**************************************** 4 '*** Code from VisibleVisual.com ******** 5 '**************************************** 6 7 Selection.Find.ClearFormatting() 8 With Selection.Find 9 .Text = searchStr 10 .Forward = True 11 .Wrap = wdFindContinue 12 .Format = False 13 .Matchcase = doMatchcase 14 .MatchWholeWord = False 15 .MatchWildcards = False 16 .MatchSoundsLike = False 17 .MatchAllWordForms = False 18 End With 19 20 If Selection.Find.Execute = True Then 21 FindText = True 22 Else 23 FindText = False 24 End If 25 26 End Function 27 28 29 Sub TestFunction() 30 31 MsgBox(FindText("VisibleVisual", True)) 32 33 End Sub
|


