Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / October 2004

Tip: Looking for answers? Try searching our database.

ItemSend event fires twice?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bingo - 29 Oct 2004 15:26 GMT
In the ItemSend event, I add an additional recipient as
BCC.  But the event will fire again so the additional
recipient will be added again and the event just keeps
firing.  Anything I'm doign wrong here?  Thanks.
Sue Mosher [MVP-Outlook] - 29 Oct 2004 15:32 GMT
Show your code. You're not sending again are you? That's unnecessary.

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> In the ItemSend event, I add an additional recipient as
> BCC.  But the event will fire again so the additional
> recipient will be added again and the event just keeps
> firing.  Anything I'm doign wrong here?  Thanks.
Bingo - 29 Oct 2004 15:49 GMT
Private Sub m_oApp_ItemSend(ByVal Item As Object, Cancel
As Boolean)

Dim oMapiRecipient As Outlook.Recipient
Dim oMapiItm As Outlook.MailItem
Dim sModName As String
Dim sMailbox As String

On Error GoTo errHandler

   Set oMapiItm = Item
   sModName = App.EXEName & ":" & CLASS_NAME
& ":ItemSendEvent"
   
   WriteEvent sModName, "ItemSend Event Starts", LOG_INFO
       
   ' Only outgoing emails need to be copied to Claimbox
   If Not oMapiItm.UserProperties("Direction") Is
Nothing And _
       oMapiItm.UserProperties("Direction") = "O" Then
       WriteEvent sModName, "Process an Outgoing
Message", LOG_INFO
               
       If sMailbox <> "" Then
           WriteEvent sModName, "Add Claimbox as BCC",
LOG_INFO
           Set oMapiRecipient = oMapiItm.Recipients.Add
(oMapiItm.UserProperties("Claimbox"))
           With oMapiRecipient
               .Resolve
               .Type = olBCC
           End With
       Else
           ' Cancel the process to keep the message
           Cancel = True
           WriteEvent sModName, "Missing Claimbox",
LOG_INFO
       End If
   End If

cleanUp:
   Set oMapiRecipient = Nothing
   Set oMapiItm = Nothing
   Exit Sub
errHandler:
   On Error Resume Next
   WriteEvent sModName, "[" & Err.Number & "] " &
Err.Description, LOG_ERROR
   GoTo cleanUp
End Sub

>-----Original Message-----
>Show your code. You're not sending again are you? That's unnecessary.
[quoted text clipped - 5 lines]
>
>.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.