Peter Hibbs - I need you!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Peter
Sorry to call you personally but your answer to my "Emails into Access" was
so good, I've used the code, thank you.
On my PC, it works a dream!
On my client PC, it reads 9 emails and then I get 'Type Mismatch' on the
'NEXT' statement at the end of the 'For Each' loop. I've deleted the email
in question, it then just happens again (on the eighth strangely!)
Any ideas on a type mismatch on the 'Next' line?
My client had subfolders below her inbox so I created sub folders below mine
but did not get the error!
If you can help, I'll divorce my wife and marry you!
PJB
 
Hi PJB

That is odd, I have not had any problems like that. You will have to do a
bit of debugging on your client PC. Are they also using Office 2003?
What have you tried so far.
What I would do first is Rem out everything between the For and Next lines
and see if the error still occurs, if it doesn't then I would guess it is one
of the instructions in that group that is causing it to fail. If it still
fails then it could be a problem with Outlook.
Incidentally, you can place a 'Restrict' clause on the For Each line to
filter the e-mails that are processed, maybe you can use this to exclude any
dodgy e-mails. The format is :-

For Each MailItem In fdrInBox.Items.Restrict(vCriteria)

where vCriteria is something like - "[Subject] <> 'some text here'"

Also, I forgot to include the delete function which moves the e-mail from
the InBox to the DeletedItems box but I guess you have already figured that
one out. Anyway, the code is :-

MailItem.Delete

and goes immediately before the Next instruction.

I don't know what else to suggest except that the Outlook Discussion Group
will know a lot more about Outlook than I do.

Regarding your proposal of marriage, I am going to have to turn you down, my
wife just won't divorce me.

Good luck and let us know how you get on, it may be helpful to others.
 
Peter - many thanks

I thought it may be something to do with Exchange as I'm on single user and
client is through Exchange. Anyhow, I'll try the debugging process, just
thought you may have seen it before (and I could save some time!! lazy devil!)
The 'delete' I did suss - an interesting point that you have to repeat the
process when a delete is done because the delete option causes the next email
in the loop to be missed. I.e. if there are 14 emails and you use the
mailitem.delete for all of them, only 7 get deleted - you have to keep
repeating the process until they are all gone!
Hope this helps somebody!
Kind regards
PJB

Peter Hibbs said:
Hi PJB

That is odd, I have not had any problems like that. You will have to do a
bit of debugging on your client PC. Are they also using Office 2003?
What have you tried so far.
What I would do first is Rem out everything between the For and Next lines
and see if the error still occurs, if it doesn't then I would guess it is one
of the instructions in that group that is causing it to fail. If it still
fails then it could be a problem with Outlook.
Incidentally, you can place a 'Restrict' clause on the For Each line to
filter the e-mails that are processed, maybe you can use this to exclude any
dodgy e-mails. The format is :-

For Each MailItem In fdrInBox.Items.Restrict(vCriteria)

where vCriteria is something like - "[Subject] <> 'some text here'"

Also, I forgot to include the delete function which moves the e-mail from
the InBox to the DeletedItems box but I guess you have already figured that
one out. Anyway, the code is :-

MailItem.Delete

and goes immediately before the Next instruction.

I don't know what else to suggest except that the Outlook Discussion Group
will know a lot more about Outlook than I do.

Regarding your proposal of marriage, I am going to have to turn you down, my
wife just won't divorce me.

Good luck and let us know how you get on, it may be helpful to others.
--
Peter Hibbs


PJB said:
Peter
Sorry to call you personally but your answer to my "Emails into Access" was
so good, I've used the code, thank you.
On my PC, it works a dream!
On my client PC, it reads 9 emails and then I get 'Type Mismatch' on the
'NEXT' statement at the end of the 'For Each' loop. I've deleted the email
in question, it then just happens again (on the eighth strangely!)
Any ideas on a type mismatch on the 'Next' line?
My client had subfolders below her inbox so I created sub folders below mine
but did not get the error!
If you can help, I'll divorce my wife and marry you!
PJB
 

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

Back
Top