[AccessD] [Spam]8.51 Re: [Spam]8.51 Re: Get sender's eMail address

Darrell Burns dhb at flsi.com
Thu Sep 1 10:28:49 CDT 2011


Sorry -- default account, not folder. I have 4 eMail accounts set up in
Outlook, and one is set as the default account. That's what I'm trying to
identify.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of William Benson
(VBACreations.Com)
Sent: Wednesday, August 31, 2011 6:22 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] [Spam]8.51 Re: [Spam]8.51 Re: Get sender's eMail
address

Here is a way to set a reference to the default mail folder:

Set MyFolder = myNameSpace.GetDefaultFolder(olFolderInbox)   ' olFolderInbox
= 6

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darrell Burns
Sent: Wednesday, August 31, 2011 5:14 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] [Spam]8.51 Re: [Spam]8.51 Re: Get sender's eMail
address

Thanx, Bill. I was able to get a list of my accounts. Do you know what the
property is for the Default account?

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of William Benson
(VBACreations.Com)
Sent: Wednesday, August 31, 2011 11:56 AM
To: 'Access Developers discussion and problem solving'
Subject: [Spam]8.51 Re: [AccessD] [Spam]8.51 Re: Get sender's eMail address

This works from Access with a reference to Outlook only... Note I have a pst
folder called GMAIL and I am searching Inbox... change to suit.


Dim myOlApp As Object
Dim myNameSpace As Object
Dim myfolders As Object
Dim MyFolder As Object
Dim myfolder2 As Object
Dim item As Object

Dim n As Long


Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI") Set myfolders =
myNameSpace.Folders

n = 1
Do Until UCase(myfolders.item(n).Name) = "GMAIL"
  n = n + 1
Loop

Set MyFolder = myfolders.item(n)
Set myfolder2 = MyFolder.Folders("Inbox")

For Each item In myfolder2.Items
  If item.Class = 43 Then
    Debug.Print item.SenderEmailAddress
  End If
Next item


End Sub


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list