I have two functions that return a portion of a string. Basically it looks for either an @ or a # and returns the text directly after it. The @ sign is easy because the last character after the text will be a space, no matter what. However, how do I work with the # because the character delimiter can be either a space or a period to end the sentence. I cannot for the life of me figure this one out. It doesn't matter which character it is, I just need to be able to get the text before. So I need to check if it is either or and then it returns the same value no matter what.
Any ideas? Thank you in advance!! 
This is what I have so far:
Code:
Function ProductName(ContactReason) As String
Dim ProductPosition As Variant
Dim TextAfterPound As String
'Find Position of #
If IsNull(ContactReason) Then
ProductPosition = 0
Else
ProductPosition = InStr(1, ContactReason, "#")
End If
'Return portion of String after #
If ProductPosition > 0 Then
TextAfterPound = Mid(ContactReason, ProductPosition + 1, 100)
Else
TextAfterPound = ""
End If
'Return Product Name
If ProductPosition = 0 Then
ProductName = "Not Specified"
Else
ProductName = Left(TextAfterPound, InStr(TextAfterPound, ".") - 1)
End If
End Function