You can't set the value of an object to a string value.
You need to do everything I mentioned, handling
Application.Inspectors.NewInspector and testing for
Inspector.CurrentItem.Class to be olMail. That will give you a handle to the
mail item and then you need to instantiate your class so it can handle the
Close event of the mail item.
<landau@skiz.net> wrote in message
news:e92ccb88-7461-43f2-aaaa-d587bac15aaf@e4g2000hsg.googlegroups.com...
> Thanks. I've tried that. This is what I have:
> In a Class Module call EdClass:
> Public WithEvents myEdItem As Outlook.MailItem
> Private Sub Class_Initialize()
> Set myItem = Application.ActiveInspector.CurrentItem
> End Sub
> Private Sub myEdItem_Close(Cancel As Boolean)
> If Not myItem.Saved Then
> MsgBox " The item was closed."
> End If
> End Sub
>
>
> Then in a standard Module, I have:
> Dim myClass As New EdClass
> Sub Register_Event_Handler()
> Set myClass.myEdItem = "Outlook.mailitem"
>
> End Sub
>
>
> But I get an error that an Object is needed when trying to instantiate
> the class (set myClass...).
>
> Any thoughts?
>
> Thanks
> -Ed