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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error trying to read outlook messages from VB6

Status
Not open for further replies.

elquixiote

Technical User
Nov 30, 2002
99
MX
Hi!. I'm develping an application to read the inbox messages in outlook.

Up to now all is ok, but, (there always a but) I'm
getting a type mismatch error when the application reads
a declination response message. If I delete it from the inbox my application continues reading the messages.

Can some body tell me what's happening ?
Of course, I could trapp the error and resume, (I'm not interested in declination messages) but I'd like to understand whats wrong.

My code is as follows:

Dim objoutlook As Outlook.application
Dim myfolder As Outlook.MAPIFolder
Dim myitem As Outlook.MailItem

Set objoutlook = CreateObject("Outlook.application")
Set nms = objoutlook.GetNamespace("MAPI")

Set myfolder = nms.GetDefaultFolder(olFolderInbox)
Text1.Text = ""
For i = 1 To myfolder.Items.Count
' I got a type mismatch error in the following line
' when the message is declination response
Set myitem = myfolder.Items(i)
Text1.Text = Text1.Text & myitem.To & "//" & myitem.Subject & vbCrLf
Next i
Text2.Text = myitem.Body

Thanks

El Quijote
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top