The fact they are "tags" is utterly irrelevant. Word does not recognize them as tags. So. You want to extract text between two
different seatch strings.
"<customer>" text text "</customer>"
or
"this is serach string 1" text text "The quick red fox blah"
Makes no difference to Word. Two
different search strings, and the text between them.
So, say, you have:
<customer>yadda blah </customer>
<customer>whatever </customer>
<customer>ho hum </customer>
shdkhskdhs asdlahd adh
Code:
Sub Blah()
Dim MyTags()
Dim r As Range
Dim r2 As Range
Dim r3 As Range
Dim msg As String
Set r = ActiveDocument.Range
MyTags() = Array("<customer>", "</customer>")
With r.Find
.ClearFormatting
Do While .Execute(Findtext:=MyTags(0), Forward:=True) = True
Set r2 = ActiveDocument.Range( _
Start:=r.End, End:=ActiveDocument.Range.End)
With r2.Find
.ClearFormatting
.Text = MyTags(1)
.Execute
Set r3 = ActiveDocument.Range( _
Start:=r.End, End:=r2.Start - 1)
msg = msg & r3.Text & vbCrLf
End With
Loop
End With
MsgBox msg
End Sub
returns (using the MsgBox msg):
yadda blah
whatever
ho hum
So. You can
get th0e text between two search strings, but this may, or may not, help. You can not, at least with the above code,
reference them.
BTW: it is easy to make the two search strings variable from a user input. So you could put in <whatever> and </whatever>, or <client> and </client>.
247.50 hours to retirement