D
DavidE
Hi,
I created a com add-in that fires an event when a new mail arrives. This is
the code:
Private WithEvents objNS As Outlook.NameSpace
Private WithEvents colItems As Outlook.Items
Private Sub Application_Startup()
Set objNS = Application.GetNamespace("MAPI") 'NameSpace Object
Set colItems = objNS.GetDefaultFolder(olFolderInbox).Items
....
End Sub
Private Sub colItems_ItemAdd(ByVal Item As Object)
Code to handle incoming mail
End Sub
Usually, this code does the work but some times it doesn't. When it stop
working the event doesn't fire for all incoming mails. I fix it by closing
and reopen the outlook. When the outlook is reopen it loads the add-in.Some
times I need to restart the computer. I tried to solve this problem by
cretaing a schedule task for a bat file that contain a regsvr32 command for
this dll but it doesn't solve the problem. I don't think that it's a problem
of code but I think that it's a problem of the outlook that unload the add-in
without a logical reason.
I'll glad to get help for this problem.
Thanks,
David
I created a com add-in that fires an event when a new mail arrives. This is
the code:
Private WithEvents objNS As Outlook.NameSpace
Private WithEvents colItems As Outlook.Items
Private Sub Application_Startup()
Set objNS = Application.GetNamespace("MAPI") 'NameSpace Object
Set colItems = objNS.GetDefaultFolder(olFolderInbox).Items
....
End Sub
Private Sub colItems_ItemAdd(ByVal Item As Object)
Code to handle incoming mail
End Sub
Usually, this code does the work but some times it doesn't. When it stop
working the event doesn't fire for all incoming mails. I fix it by closing
and reopen the outlook. When the outlook is reopen it loads the add-in.Some
times I need to restart the computer. I tried to solve this problem by
cretaing a schedule task for a bat file that contain a regsvr32 command for
this dll but it doesn't solve the problem. I don't think that it's a problem
of code but I think that it's a problem of the outlook that unload the add-in
without a logical reason.
I'll glad to get help for this problem.
Thanks,
David