21 | 09 | 2017

VisibleVisual.com | Word VB Articles

Find Text

 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. 


Function FindText(ByVal searchStr As String, Optional ByVal doMatchcase As Boolean = False) As Boolean

'*** Code from VisibleVisual.com ********

With Selection.Find
	.Text = searchStr
	.Forward = True
	.Wrap = wdFindContinue
	.Format = False
	.Matchcase = doMatchcase
	.MatchWholeWord = False
	.MatchWildcards = False
	.MatchSoundsLike = False
	.MatchAllWordForms = False
End With
If Selection.Find.Execute = True Then
	FindText = True
	FindText = False
End If
End Function
Sub TestFunction()

   MsgBox(FindText("VisibleVisual", True))
End Sub

Sign up now and upload your code to the website.

Help us to continue.....
Articles View Hits
Latest Articles