Sub test()
Dim re As RegExp, m As MatchCollection
Set re = New RegExp
Dim MyText As String, extractedText As String
MyText = "anything textToExtract anything"
re.Pattern = "anything (.*) anything"
Set m = re.Execute(MyText)
extractedText = m(0).SubMatches(0)
End Sub