The event handler did have a problem. The following worked:
Dim WithEvents myInboxMailItem As Outlook.Items
Private Sub myInboxMailItem_ItemAdd(ByVal Item As Object)
Call MsgBox("Item Added", vbOKOnly, strMailBoxName)
End Sub
Private Sub Initialize_Handler()
Dim fldInbox As Outlook.MAPIFolder
Dim gnspNameSpace As Outlook.NameSpace
Set gnspNameSpace = Outlook.GetNamespace("MAPI") 'Outlook Object
Set fldInbox = gnspNameSpace.Folders(strMailBoxName).Folders("Inbox")
Set myInboxMailItem = fldInbox.Items
End Sub
Private Sub Application_Startup()
Call Initialize_Handler
End Sub
"Sue Mosher [MVP-Outlook]" wrote:
> Your event handler code looks fine, but do you know for sure that it's running when Outlook starts? Did you try setting a breakpoint?
>
> --
> Sue Mosher, Outlook MVP
> Author of
> Microsoft Outlook Programming - Jumpstart for
> Administrators, Power Users, and Developers
> http://www.outlookcode.com/jumpstart.aspx
>
>
> "Jim Machia" <(E-Mail Removed)> wrote in message news:4CD6C862-F9D2-4161-B85F-(E-Mail Removed)...
> > strMailBoxName is Hardcoded for the second mailbox and yes I can navigate the
> > inpox folder of that mailbox,
>
> >> >
> >> > Dim WithEvents myFolderInbox As Outlook.MAPIFolder
> >> >
> >> > Private Sub myFolderInbox_ItemAdd()
> >> > Call MsgBox("Item Added", vbOKOnly, strMailBoxName)
> >> > End Sub
> >> >
> >> > Private Sub Initialize_Handler()
> >> > Dim fldInbox As Outlook.MAPIFolder ' Outlook Object Model - MAPI Folder
> >> > Dim gnspNameSpace As Outlook.NameSpace
> >> > Set gnspNameSpace = Outlook.GetNamespace("MAPI")
> >> > Set fldInbox = gnspNameSpace.Folders(strMailBoxName).Folders("Inbox")
> >> > Set myFolderInbox = fldInbox.Items
> >> > End Sub
> >> > Private Sub Application_Startup()
> >> > Call Initialize_Handler
> >> > End Sub
> >> >
> >> > "Sue Mosher [MVP-Outlook]" wrote:
> >> >
> >> >> You'd need to set up an event handler for the other mailbox's Inbox folder using the MAPIFolder.Items.ItemAdd event.
> >> >>
> >> >> --
> >> >> Sue Mosher, Outlook MVP
> >> >> Author of
> >> >> Microsoft Outlook Programming - Jumpstart for
> >> >> Administrators, Power Users, and Developers
> >> >> http://www.outlookcode.com/jumpstart.aspx
> >> >>
> >> >>
> >> >> "Jim Machia" <(E-Mail Removed)> wrote in message news:579A23A6-7DB1-4988-BD81-(E-Mail Removed)...
> >> >> >I have 2 Microsoft Exchange Server mailboxes in Outlook 2000. The first is my
> >> >> > account mailbox and the other is an addition via the Services|Advanced tab of
> >> >> > the Services diaglog for the Exchange Server. The second mailbox is a generic
> >> >> > account that has been adminstered to give only me permission.
> >> >> >
> >> >> > I have a VBA project (ThisOutlookSecssion) and the procedure
> >> >> > Application_Startup that starts, if new mail is waiting in either mailbox. I
> >> >> > have the procedure Application_NewMail that starts, if new mail is only
> >> >> > waiting in the first mailbox. How could I get the code to start for the
> >> >> > second mailbox ?
> >> >>
> >>
>