NewInspector event stop firing after a while

A

Asa H

I have created an Outlook Add-in based on the ItemsCB example. My
problem is that the NewInspector event stop firing after a while.
Somtimes everything works fine for hours, sometimes only a few
minutes. Does some object go out of scope or what is happening?

I'm using Outlook 2002 sp-2 on Windows XP sp-1.

Thanks in advance!
Asa

This is part of my code:

--------------------------
--- Connect Module -------
--------------------------
Implements IDTExtensibility2

Private WithEvents mobjOutlook As Outlook.Application
Private WithEvents mcolInsp As Outlook.Inspectors

Private Sub IDTExtensibility2_OnConnection(ByVal Application As
Object, _
ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _
ByVal AddInInst As Object, custom() As Variant)

Set mobjOutlook = Application
If mobjOutlook.Explorers.Count > 0 Then
Set mcolInsp = mobjOutlook.Inspectors
gsProgID = AddInInst.ProgId
Else
Set mobjOutlook = Nothing
End If
End Sub

Private Sub mcolInsp_NewInspector(ByVal Inspector As
Outlook.Inspector)
If Inspector.CurrentItem.Class = olMail Then
AddInspector Inspector
End If
End Sub
--------------------------
--- End Connect Module ---
--------------------------

----------------------------------
--- Inspector Wrap Handler -------
----------------------------------
Public Sub AddInspector(vobjInsp As Outlook.Inspector)
Dim objInspWrap As InspWrap

Set objInspWrap = New InspWrap
With objInspWrap
.Inspector = vobjInsp
.CurrentMailItem = vobjInsp.CurrentItem
.Key = mnID
End With
gcolInspWrap.Add objInspWrap, "key" & CStr(mnID)
mnID = mnID + 1
Set objInspWrap = Nothing
End Sub
 
K

Ken Slovak - [MVP - Outlook]

Are you saying that when a new item is opened after a while the
NewInspector event doesn't fire? I've never seen that behavior. Does
this happen on other machines also?
 
Å

Åsa Holmgren

Yes, I've been testing on two machines with the same configuration.
I found another post in the group
"microsoft.public.office.developer.outlook.vba" written 2003-10-02 with the
title "Outlook VBA events stop firing after a while", so there is at least
one more person who has the same experience ;-)

/Asa

Ken Slovak - said:
Are you saying that when a new item is opened after a while the
NewInspector event doesn't fire? I've never seen that behavior. Does
this happen on other machines also?
 
K

Ken Slovak - [MVP - Outlook]

Any errors in the Windows event logs for Applications or System? Any
errors that aren't being handled in your code? You need to have at
minimum an On Error Resume Next statement in every procedure. Any
objects you're not releasing?

Does the same thing happen if you run under the debugger and set a
Watch window to stop execution on any errors? I don't see that thread
you mentioned, was there a resolution in it?
 
Å

Åsa Holmgren

Yes, I have error handlers in every procedure and I have checked releasing
of objects. Lots of troubles to quit Outlook if not...

I have no possibility to run a debugger on these two computers so I have to
debug "in the code" with message boxes or log files.

Where do I find the event logs?

The other thread had no solution, just a question from Tom Rizzo if the
users was opening up new explorers and launching the new
inspectors from there. That is not case with "my users".

/Åsa
 
K

Ken Slovak - [MVP - Outlook]

To see the event logs open the Control Panel and the Administrative Tools
applet. From there you can open the Windows Event Viewer and look in the
Applications and System logs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top