PDA

View Full Version : Warning message script - Debug issue!



RyanShaw
08-16-2013, 07:40 AM
Hey,

I'm pretty new at this and need some help. Im trying to create a script that will pop up a message to users after querying specific emails. So far I have it working, however when ever I send or accept a meeting request, for some reason the script faults and comes up with a debug message. I cant figure out why.

Here is the script I have and any help would be appretiated!



Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If InStr((Item.To), "Change Control") Then
Prompt$ = "This email is for a High Importance Client. Please double check Circuit ID, BPSO, and TX before sending." & Chr(13) & "" & Chr(13) & "EG. 17418CGCG; MTFS-134-L10" & Chr(13) & "" & Chr(13) & " BPSO 4824"
If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check Address") = vbNo Then
Cancel = True
End If
End If

End Sub

skatonni
08-16-2013, 10:20 AM
The To property applies to Mailitem

You will need


If TypeOf item Is MailItem Then

RyanShaw
08-16-2013, 10:30 AM
Thanks for the response,

Sorry I'm a noob beyond all standards. Could you break it down a bit more? Were would I indetify the recipiant in that?


[If TypeOf item Is MailItem "Change Control" Then/CODE]

Thanks for your help!



The To property applies to Mailitem

You will need

[CODE]If TypeOf item Is MailItem Then

skatonni
08-16-2013, 12:17 PM
Process mail only if you use Item.To.


Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If TypeOf Item Is MailItem Then
If InStr((Item.To), "Change Control") Then
Prompt$ = "This email is for a High Importance Client. Please double check Circuit ID, BPSO, and TX before sending." & Chr(13) & "" & Chr(13) & "EG. 17418CGCG; MTFS-134-L10" & Chr(13) & "" & Chr(13) & " BPSO 4824"
If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check Address") = vbNo Then
Cancel = True
End If
End If
End If

End Sub