|Page [ 1 ]|
|Basic Outlook Printer Friendly Version|
|Working with Outlook items, folders, recipients; dealing with security; writing event handlers|
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")
But find method is not working or gives me my needs.
Anyone can help?
Abdullah Alahdal 27-Jul-2010 12:02
I tried this as well, no luck.
If InStr(Item.Body, "SomeThing") Is Nothing Then
Call MsgBox("Fine", vbOKOnly, "Fine")
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.
Some People were found to make our life easier.
Thanks a lot.
|Page [ 1 ]|
|Post a new message to this topic.