Hi Guys,
I have a function that returns a Boolean based on whether a string is found on the first page of my document or not. It is returning False when I know it should be True.
Function SearchForSentence(strSentence As String) As Boolean
Selection.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=1
With Selection.Find
.Text = strSentence
.Forward = True
.Wrap = False
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
SearchForSentence = Selection.Find.Execute
End Function
The string I am searching for is "FEDERAL COURT OF"
Any ideas where I have gone wrong?
Thanks
I have a function that returns a Boolean based on whether a string is found on the first page of my document or not. It is returning False when I know it should be True.
Function SearchForSentence(strSentence As String) As Boolean
Selection.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=1
With Selection.Find
.Text = strSentence
.Forward = True
.Wrap = False
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
SearchForSentence = Selection.Find.Execute
End Function
The string I am searching for is "FEDERAL COURT OF"
Any ideas where I have gone wrong?
Thanks