[AccessD] Pulling Data from Outlook into Access

Brad Marks BradM at blackforestltd.com
Fri Sep 2 15:15:22 CDT 2011


All,

Below is a small Sub that pulls data from Outlook into Access.  This
works fine to pull data from my Outlook Mailbox.

I now need to pull data that resides in a different Outlook Mailbox.  I
have the Mailbox name and password.

Is this possible?

Thanks,
Brad
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sub Outlook_Test()

Dim myOlApp As Outlook.Application
Dim myNameSpace As Object
Dim myFolders As Object
Dim myFolder As Object
Dim mySubFolder As Object
Dim Item As Object

Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolders = myNameSpace.Folders
Set myFolder = myFolders.Item(1)
Set mySubFolder = myFolder.Folders("Inbox")

For Each Item In mySubFolder.Items
 MsgBox Item.Subject & vbLf & Item.Body
Next Item

End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




More information about the AccessD mailing list