![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I found this function in this group, and trying to use in my macro,
But I have problem with this line... If Contains(Item.To, "Marcus") Or Contains(Item.To, "Info") Then What is wrong? CODE ************************************ Public Function Contains(spBody, ParamArray spText() As Variant) As Boolean Dim slText As Variant For Each slText In spText() If InStr(spBody, slText) Then Contains = True Exit For End If Next End Function ************************************ Private Sub colSentItems_ItemAdd(ByVal Item As Object) If Item.Class = olMail Then Dim intRes As Integer Dim strMsg As String If Contains(Item.To, "Lisa") Or Contains(Item.To, "Anna") Then strMsg = "Do you set a Orange flag with follow up in 7 days to this message in Sent Items?" intRes = MsgBox(strMsg, vbYesNoCancel + vbDefaultButton1, "Set flag") Select Case intRes Case vbNo 'Do nothing Case vbCancel Cancel = True Case vbYes Item.FlagIcon = olOrangeFlagIcon Item.FlagStatus = olFlagMarked Item.FlagDueBy = Now + 7 Item.FlagRequest = "Follow up" End Select End If Item.Save End If End Sub ************************************ |
Ads |
#2
|
|||
|
|||
![]() |
#3
|
|||
|
|||
![]()
It's hard to know what's wrong since you didn't provide any example of typical data or what symptoms you're seeing. Stepping through the code in the debugger might be very useful.
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx wrote in message oups.com... I found this function in this group, and trying to use in my macro, But I have problem with this line... If Contains(Item.To, "Marcus") Or Contains(Item.To, "Info") Then What is wrong? CODE ************************************ Public Function Contains(spBody, ParamArray spText() As Variant) As Boolean Dim slText As Variant For Each slText In spText() If InStr(spBody, slText) Then Contains = True Exit For End If Next End Function ************************************ Private Sub colSentItems_ItemAdd(ByVal Item As Object) If Item.Class = olMail Then Dim intRes As Integer Dim strMsg As String If Contains(Item.To, "Lisa") Or Contains(Item.To, "Anna") Then strMsg = "Do you set a Orange flag with follow up in 7 days to this message in Sent Items?" intRes = MsgBox(strMsg, vbYesNoCancel + vbDefaultButton1, "Set flag") Select Case intRes Case vbNo 'Do nothing Case vbCancel Cancel = True Case vbYes Item.FlagIcon = olOrangeFlagIcon Item.FlagStatus = olFlagMarked Item.FlagDueBy = Now + 7 Item.FlagRequest = "Follow up" End Select End If Item.Save End If End Sub ************************************ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How do I customize my work week if I work different hours daily? | Pratherer | Outlook - Calandaring | 1 | October 31st 06 05:57 AM |
did it work | Romulus R Johnson | Outlook Express | 0 | October 27th 06 03:39 PM |
Archiving just will not work for me. | Austin Powers | Outlook - General Queries | 2 | October 26th 06 01:05 AM |
e-mail alerts don't work,setup but don't work- | Studmn1 | Outlook - General Queries | 3 | August 24th 06 09:38 PM |