Reputation: 221
How can you detect if the selection you have contains or is the section break character?
At the moment I select a page , collapse to the end , I want to know if the end of the page contains a section break or not.
I was going to use a method where I compare the section number at the end of the page , then move two characters forward , then check the section number. If they are different then the end of my page does have a section break - is there a better way to do it?
Upvotes: 1
Views: 5683
Reputation: 221
Cheers that's a good suggestion.
The way I did it in the end was get the range of the page and section , check both "End" positions , if they were the same then the page contained the section break.
Upvotes: 1
Reputation: 91306
Perhaps something on these lines:
Function HasBreak() As Boolean
With Selection.Find
.Forward = True
.Execute FindText:="^b"
If .Found Then
HasBreak = True
End If
End With
End Function
Upvotes: 2