Inspector Bug/Question

  • Thread starter QWRkaW5fTm9vYg
  • Start date Views 1,541
Status
Not open for further replies.
Q

QWRkaW5fTm9vYg

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
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
How do you set m_colInspectors, and why do you think it doesn't refer to

Inspector.CurrentItem?

Best regards

Michael Bauer

Am Mon, 6 Apr 2009 20:44:01 -0700 schrieb 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
 
Q

QWRkaW5fTm9vYg

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

"Michael Bauer " wrote:



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

> > Best regards
> Michael Bauer

> > >

> Am Mon, 6 Apr 2009 20:44:01 -0700 schrieb 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

>
 
Q

QWRkaW5fTm9vYg

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

"Addin_Noob" wrote:


> 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
>
 
Status
Not open for further replies.
Top