William Benson (VBACreations.Com)
vbacreations at gmail.com
Wed Aug 31 17:01:02 CDT 2011
Not really, sorry. This is looping through pst files (folders) not
"accounts". Accounts are added to pst files, but there is no way that I
know of to trace a mailitem to the account which it came through. You can
check the item to see how it was addressed. Basically all I know how to do
is loop through folders to see what is in them. That other product
Redemption I feel has all the tools you need, but there is a learning curve.
Sub oltest()
'\GMAIL\INBOX\~PROGRAMMING\ACCESS\
'''''''''''''''''''''''''''''''''''''''''S A M P L E R E S U L T
'''''''''''''''''''''''''''''''''''''''''''''''''''
'SentFrom: ACCESS-L at PEACH.EASE.LSOFT.COM SentTo: Bill Benson
(vbacreations) <ACCESS-L at PEACH.EASE.LSOFT.COM>
'SentFrom: accessd-bounces at databaseadvisors.com SentTo: Bill Benson
<Access Developers discussion and problem solving>
'''''''''''''''''''''''''''''''''''''''''S A M P L E R E S U L T
'''''''''''''''''''''''''''''''''''''''''''''''''''
Dim myOlApp As Object
Dim myNameSpace As Object
Dim myfolders As Object
Dim MyFolder As Object
Dim myfolder2 As Object
Dim myfolder3 As Object
Dim myfolder4 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")
Set myfolder3 = myfolder2.Folders("~Programming")
Set myfolder4 = myfolder3.Folders("Access")
For Each item In myfolder4.Items
If item.Class = 43 Then
Debug.Print "SentFrom: " & item.SenderEmailAddress & " SentTo: " &
item.ReceivedByName & " <" & item.To & ">"
End If
Next item
End Sub
-----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