Custom Inbox handler - strange behavior 
Author Message
 Custom Inbox handler - strange behavior

I am using the following VBA code to provide a custom rule for my personal
inbox and a shared exchange account inbox.  When mail is received, the
associated ItemAdd event is always fired for my inbox, but not for the the
other account.  After certain external actions such as starting the VB 6 IDE
(existing or new blank project, then shutting down), the ItemAdd event for
the other account will
start firing.  Any ideas why?

Thanks,
Bob
---------
Option Explicit
Public WithEvents gw_oMyItems As Outlook.Items
Public WithEvents gw_oCuisItems As Outlook.Items

'---------
'Initialize global object so that new items will be detected
'
Public Sub Application_Startup()
    Dim oRecipient As Outlook.Recipient

    'My Inbox items object
    Set gw_oMyItems = Outlook.Session.GetDefaultFolder(olFolderInbox).Items

    'CUIS Inbox items object
    Set oRecipient = Outlook.Session.CreateRecipient("GRP CUIS Customer
Support")
    oRecipient.Resolve
    If oRecipient.Resolved Then
        Set gw_oCuisItems =
Outlook.Session.GetSharedDefaultFolder(oRecipient, olFolderInbox).Items
    End If
End Sub

'---------
'CUIS Inbox - tailored notification
'
Private Sub gw_oCuisItems_ItemAdd(ByVal Item As Object)

    'Ignore non-mail items
    If TypeName(Item) <> "MailItem" Then Exit Sub

    'Custom handling here
End Sub

'---------
'My Inbox - tailored notification
'
Private Sub gw_oMyItems_ItemAdd(ByVal Item As Object)

    'Ignore non-mail items
    If TypeName(Item) <> "MailItem" Then Exit Sub

    'Custom handling here
End Sub



Tue, 13 Apr 2004 07:38:16 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Strange Behavior From Custom Control

2. Strange tab behavior from custom control

3. Exception handler behavior...

4. Custom Form Posting to InBox rather Public Folder

5. Custom inbox addins

6. MoveFirst, MoveLast strange behavior

7. Strange Subform Record Behavior

8. word mail merge strange behavior

9. Strange behavior with INT function

10. strange behavior

11. Strange behavior in Add-Ins

12. Strange Behavior

 

 
Powered by phpBB® Forum Software