Inspector Bug/Question

A

Addin_Noob

Hopefully this isn't too confusing: When I click New->Appointment, this fires
the new inspector event. But when I refer to inspector.currentitem, it seems
to refer to whichever email message is highlighted in the inbox rather than
the new appointment.

Heres a code snippet:

Private Sub m_colInspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
On Error Resume Next
Dim objItem As Object
Set objItem = Inspector.CurrentItem
MsgBox objItem.Subject
End Sub


Any ideas why this happens? Sorry I'm still learning.

-Tim
 
M

Michael Bauer [MVP - Outlook]

How do you set m_colInspectors, and why do you think it doesn't refer to
Inspector.CurrentItem?

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Mon, 6 Apr 2009 20:44:01 -0700 schrieb Addin_Noob:
 
A

Addin_Noob

Thank you for the quick reply,

I have m_colInspectors defined as follows:

Dim WithEvents m_colInspectors As Outlook.Inspectors

Private Sub Application_Startup()
Set m_colInspectors = Application.Inspectors
End Sub

Private Sub m_colInspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
On Error Resume Next
Dim objItem As Object
Set objItem = Inspector.CurrentItem
MsgBox objItem.Subject
End Sub

Normally this displays the subject line for whatever mailitem I open.
However, when I click New -> Appointment, the message still pops up with the
subject line of whatever was last selected... but only sometimes. Seems hit
or miss. Please let me know what you think.

-Tim
 
A

Addin_Noob

Mike,

I figured it out... Turned out that I had defines objItem as a mailitem and
not an object. Since I had a pesky "On Error Resume Next" I wasn't getting a
runtime error and it was defaulting to the last item avalible. I appreciate
the support. Thanks.

-Tim
 

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