accessing numerous inboxes with vba




I am using Outlook 2003 as my client and Access 2003 to access emails from
Outlook (parsed emails). My problem is that I have 5 accounts connected
with my Outlook and I need to access them individually thru code. Under the
"All Mail Folders" I have Hotmail, Personal Folders, Doe01 and Doe02 (as
examples). With my modules in Access, I want (need) to get to those
folders. Can anyone show me how to access the Doe01 inbox with the
following code?

Private Sub Command3_Click()
Dim Olapp As Outlook.Application
Dim Olmapi As Outlook.NameSpace
Dim Olfolder As Outlook.MAPIFolder
Dim OlAccept As Outlook.MAPIFolder
Dim OlDecline As Outlook.MAPIFolder
Dim OlFailed As Outlook.MAPIFolder
Dim OlMail As Object ' Have to late bind as appointments e.t.c screw it up
Dim OlItems As Outlook.Items
Dim OlRecips As Outlook.Recipients
Dim OlRecip As Outlook.Recipient
Dim Rst As Recordset
Set Rst = CurrentDb.OpenRecordset("tblHold")
Set Olapp = CreateObject("Outlook.Application")
Set Olmapi = Olapp.GetNamespace("MAPI")
Set Olfolder = Olmapi.GetDefaultFolder(olFolderInbox) <<< Here ???
Set OlItems = Olfolder.Items
Set OlAccept = Olfolder.Folders("Passed")
Set OlFailed = Olfolder.Folders("Failed")



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