PDA

View Full Version : Item send - check for Meetings



Lef_pl
09-29-2021, 02:52 AM
Hello,

If you could kindly assist me with below matter:

I have a simple macro that runs on "Item send" event.
It works very well but it also triggers when users send invitations for meetings.

Could you suggest how can I check before sending if the item is email or meeting?

Please see my code below.



Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

Dim question As String
Dim strSubj As String


strSubj = Item.subject
Item.Display
If InStr(Item.subject, "[Confidential]") > 0 Then
Exit Sub
Else '

question = MsgBox("Please do something", , "Attention")

MENU.SHOW
Cancel = True

End If

End Sub


Kind Regards,
Lef

gmayor
09-29-2021, 04:54 AM
It is a simple matter to establish what Item is before running the code e.g.


Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

Dim question As String
Dim strSubj As String

If TypeName(Item) = "MailItem" Then
strSubj = Item.Subject
Item.Display
If InStr(Item.Subject, "[Confidential]") > 0 Then
Exit Sub
Else '
question = MsgBox("Please do something", , "Attention")
MENU.Show
Cancel = True
End If
End If
End Sub

Lef_pl
09-29-2021, 10:18 AM
Gmayor,

Thank You.
It works like a charm.:clap: