I am using these two functions as I want to return the last non-numeric word in a text string. The text string has spaces as separators between numbers and text.
In isolation these functions work as expected. But when I combine them, I always get a blank result. Not sure why this happens.
Function ReturnLastWord(The_Text As String)
Dim stGotIt As String
stGotIt = StrReverse(The_Text)
stGotIt = Left(stGotIt, InStr(1, stGotIt, " ", vbTextCompare))
ReturnLastWord = StrReverse(Trim(stGotIt))
End Function
Function RemoveNumbers(Txt As Variant) As String
With CreateObject("VBScript.RegExp")
.Global = True
.Pattern = "[0-9]"
RemoveNumbers = .Replace(Txt, "")
End With
End Function
sub test
Dim mystring as string
mystring = ReturnLastWord(RemoveNumbers(c_str))
end sub