Untalented
Untalented

Reputation: 157

Outlook Script To Check for Text In Body

I have a script we use. What I need a portion of this to do is look for a link embedded in the e-mail and skip the script if it finds it. However, it's not working:

If Item.Class = "43" Then
If InStr(Item.Body, "https://mywebsite.local/TEMP*") = 1 Then
GoTo NonEmailError
End If

So after the TEMP is actually some random characters. It doesn't appear the wild card works in the above. Is there a way to use a wildcard in this type of statement? What can I do here?

Upvotes: 1

Views: 4674

Answers (1)

mkingston
mkingston

Reputation: 2718

Actually, having commented already, I suspect your problem is in fact that you're testing that InStr returns 1. This will probably fix your problem:

If InStr(Item.Body, "https://mywebsite.local/TEMP") > 0 Then

Edit: you'll still need to remove the wildcard.

Upvotes: 1

Related Questions