Import Outlook Custom Form Data From Another Inbox

  • Thread starter Thread starter Boyd
  • Start date Start date
B

Boyd

I have a vba process that cycles thru my Inbox and imports data from a
number of custom forms. This data is then updated within my access
database, and reports are created. I tried using the same vba code to
cycle thru another mailbox (which i have admin rights to), but am
receiving a "type mismatch" error on line# 3 below.

Dim fld As Outlook.MAPIFolder
Dim itm as Object

'Assuming fld is populated in prior steps using the PickFolder command

1) For Each itm In fld.Items
2) If itm.Class = olMail Then
3) Set msg = itm
....
....
5) Next itm

Any ideas why this code works fine when selecting an Outlook folder
within my mailbox, but errors when selecting a folder in another
mailbox?

Thanks,
Boyd
 
Dim fld As Outlook.MAPIFolder
Dim itm as Object

'Assuming fld is populated in prior steps using the PickFolder command

1) For Each itm In fld.Items
2) If itm.Class = olMail Then
3) Set msg = itm
...
...
5) Next itm

Any ideas why this code works fine when selecting an Outlook folder
within my mailbox, but errors when selecting a folder in another
mailbox?

Do you have a Dim for msg specified anywhere?

John W. Vinson [MVP]
 
Thanks for responding John. Further up in my code I dim msg As
Outlook.MailItem. Sorry I didn't include this in my code sample.

Any ideas?
Boyd
 

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