Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Juicy one...

Status
Not open for further replies.

datawise

IS-IT--Management
Sep 14, 2001
27
EU
I have a form in Access that retrieves a list of unread emails from outlook using the following code:

For Each mailoutlook in folderOutlook.Items
If mailoutlook.UnRead = True Then
'Add to rowsource of list box here
End if
Next

This has worked fine until I got a Non Delivery Report in my inbox. The code bombed out on the Next when it got to the NDR. The error code is 13: Type Mismatch. Looking at the messages by linking Access to my Inbox I discovered that the MessageClass of the NDR is different from a standard email: it is REPORT.IPM.Note.NDR rather than IPM.Note.

Has anyone experienced this? Apart from checking the error number and resuming next is there a way to work around this? It would be useful to have NDRs display on my form.

Thanks,

Peter
Datawise Computing
 
the type of mailoutlook is mailitem, i presume. insert before your for cycle an
on error resume next
statement, or check the type of the act item before the if.

ide
 
Yes, it is a mailitem, and I've already done the resume next. My problem is that I want to display the NDR and resume next doesn't do this.

Thanks,

Peter
 
i'm sorry i didn't answer Your reply but i'm on a course.
I've tried the declaration:
Dim mailOutlook As MailItem
i get the same error message.

change the type of mailOutlook variable to:
Dim mailOutlook As Object
or
Dim mailOutlook As Variant
(and all variables you use to store the act item..)

i hope it helps You
ide
 
Thanks, I think this is on the right track, but unfortunately I get an "Object doesn't support this property or method" error when I dim as an object or variant.

Peter
 
Check your References in your Script Editor. Check your library choices.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top