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

Darrell Burns dhb at flsi.com
Thu Sep 1 14:37:48 CDT 2011


Excellent, Bill. I really appreciate your persistence on this.
Thanx!

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

Ahhh. Found something.

Debug.Print olApp.Session.CurrentUser.Address shows

the e-mail address that is used by default for a new message.



-----Original Message-----
From: William Benson (VBACreations.Com) [mailto:vbacreations at gmail.com]
Sent: Thursday, September 01, 2011 1:26 PM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] [Spam]8.51 Re: [Spam]8.51 Re: Get sender's eMail
address

Not sure it can be done without Redemption because there just is nothing
exposed through the Outlook library that lets you examine the Session object
that carefully. All accounts are in the Accounts collection but there is
nothing about any of those objects which tells you it is the default, and
nothing about the Session object itself which indicates what account will be
used by default to send a message.

At least insofar as I have been able to discover through the Locals window.

Good luck in the quest and let us know if you get farther, I would like to
know.

FYI ... this is drifting far away from getting the Sender's e-mail address
... was that resolved to your satisfaction?
Bill

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darrell Burns
Sent: Thursday, September 01, 2011 11:29 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] [Spam]8.51 Re: [Spam]8.51 Re: Get sender's eMail
address

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

--
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