Set oInsp = oApp.ActiveInspector CRASHES

J

Joel Finkel

Folks,

Can someone enlighten me as to why this rather simple bit of code will
consistently crash Outlook as soon as it attempts to set the Inspector to the
ActiveInspector?

I have a mail message. I have a button on the inspector (form), and that
button triggers this code. Kaboom! I am asked to forward the dump to
Microsoft. I am running Oulook 2003 (SP2).

Thanks in advance.

/Joel Finkel

Sub test()

Dim oApp As Application
Dim oInsp As Inspector
Dim oItem As Object

Set oApp = CreateObject("Outlook.Application")
Set oInsp = oApp.ActiveInspector

'Test if an inspector is active
If Not TypeName(oInsp) = "Nothing" Then
Set oItem = oInsp.CurrentItem
End If
End Sub
 
T

Tony Jollans

I don't see why you need the CreateObject - why not just

Set oInsp = Application.ActiveInspector

And I would check ...

If Not oInsp Is Nothing Then

rather than the convoluted TypeName construct.

But, regardless of all that, it works for me. Have you tried Help > Detect
and Repair?
 

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