PDA

View Full Version : select a string of word from current cursor position to the string Membership Status:



DSDressler
2017-08-19, 04:01 AM
I want to select the string of words from the current cursor position to but not including the string "Membership Status:" Thinking easy but mind not working right now... Thanks for any help.

macropod
2017-08-19, 11:26 AM
Try, for example:

Sub Demo()
Const StrFnd As String = "Membership Status:"
With ActiveDocument.Range(Selection.Start, ActiveDocument.Range.End)
With .Find
.Text = StrFnd
.Execute
End With
If .Find.Found = True Then Selection.End = .Start
MsgBox Selection.Text
End With
End Sub

DSDressler
2017-08-25, 12:52 PM
Works Great! Thanks for your help...