Quote:
Originally Posted by gmaxey
Test, Joe Smith, and test, test.
or
Test, Bob Miller, and test, text.
It will not match any of the examples given in post #3.
|
For data structured as in the attached photo, the sample code is below
This is just an example. Everyone should make corrections for their needs
Code:
Sub ScratchMacro()
Dim RegEx As Object, Matches As Object, Match As Object
Set RegEx = CreateObject("VBScript.RegExp")
With RegEx
.Global = True
.Pattern = ", [A-Z][^, ]+( [A-Za-z][^,]+){1,},"
End With
Set Matches = RegEx.Execute(ActiveDocument.Range.Text)
For Each Match In Matches
Debug.Print Match.Value
Next
End Sub