|
|
|||
| Basic Outlook Printer Friendly Version | |||
|
|
Working with Outlook items, folders, recipients; dealing with security; writing event handlers | ||
| Topic | |||
|
|
Find Text
I am trying to search (find) string in the email body at the send time I tried many times but no success. below is one of my trying: Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) If Item.Body.Find("Something I am looking for") Is Nothing Then Call MsgBox("It is not there", vbOKOnly, "Close Me") Else End If End Sub But find method is not working or gives me my needs. Anyone can help? Abdullah Alahdal 27-Jul-2010 12:02 |
||
|
|
Abdullah Alahdal
27-Jul-2010 12:17
I tried this as well, no luck. If InStr(Item.Body, "SomeThing") Is Nothing Then Exit Sub Else Call MsgBox("Fine", vbOKOnly, "Fine") End If |
||
|
|
Sue Mosher
27-Jul-2010 12:27
This is the problem expression: InStr(Item.Body, "SomeThing") Is Nothing Instr() returns an integer representing the position of the next, not an object. This expression will return True if the text is not found, False if it is found: InStr(Item.Body, "SomeThing") = 0 Remember that you can look up functions like Instr() in VBA Help if they don't appear to be working as expected. Simply put the cursor on the function name in your code and press F1. |
||
|
|
Abdullah Alahdal
27-Jul-2010 14:41
Some People were found to make our life easier. Thanks a lot. |
||
|
|
|||
| Post a new message to this topic. |
