Mir wurde schon versucht zu helfen, habe grad diesen Code drinnen:
Sub TestRegEx()
Dim TextStr As String, PatternStr As String
TextStr = "Asset ID: 9949198076 Asset Description: Kindle"
PatternStr = "(\d{10})"
Debug.Print ExtractSubStrWRegEx(PatternStr, TextStr)
End Sub
Function ExtractSubStrWRegEx(ByVal PatternStr As String, ByVal TextStr As String) As String
Dim RE As Object
Set RE = CreateObject("vbscript.regexp")
RE.pattern = PatternStr
RE.Global = True
RE.IgnoreCase = True
Dim allMatches As Object
Set allMatches = RE.Execute(TextStr)
If allMatches.Count 0 Then
ExtractSubStrWRegEx = allMatches.Item(0).SubMatches.Item(0)
Else
ExtractSubStrWRegEx = ""
End If
End Function
Ich freue mich auf jede Antwort :)