accessguy52
Programmer
Hi -
Does anyone know how to extract a full email address from Outlook? In essence, I need to find code that will return or determine not just the SenderName, but the full email address of that sender IN ACCESS. A book I have, "VBA For Microsoft Office 2000 Unleashed", has a function that is supposed to do this in Outlook, but all I get is still a sendername, e.g. Bob Jones, rather than "bjones@some-place.com".
Thanks!
BTW, here is that code for anyone who is curious:
'---------------------------------------------------
Public Function SenderAddress(msg As MailItem) As String
Dim replyItem As MailItem
'Create a temporary reply
'
Set replyItem = msg.Reply
'The reply's To property holds the sender's address
'
SenderAddress = replyItem.To
Set replyItem = Nothing
End Function
'Sub to test the function
Public Sub SenderAddressTest()
Dim ns as Namespace
Dim ib as MapiFolder
Set ns = ThisOutLookSession.Session
Set ib = ns.GetDefaultFolder(olFolderInbox)
MsgBox SenderAddress(oFolder.Items(2))
End Sub
accessguy52
Does anyone know how to extract a full email address from Outlook? In essence, I need to find code that will return or determine not just the SenderName, but the full email address of that sender IN ACCESS. A book I have, "VBA For Microsoft Office 2000 Unleashed", has a function that is supposed to do this in Outlook, but all I get is still a sendername, e.g. Bob Jones, rather than "bjones@some-place.com".
Thanks!
BTW, here is that code for anyone who is curious:
'---------------------------------------------------
Public Function SenderAddress(msg As MailItem) As String
Dim replyItem As MailItem
'Create a temporary reply
'
Set replyItem = msg.Reply
'The reply's To property holds the sender's address
'
SenderAddress = replyItem.To
Set replyItem = Nothing
End Function
'Sub to test the function
Public Sub SenderAddressTest()
Dim ns as Namespace
Dim ib as MapiFolder
Set ns = ThisOutLookSession.Session
Set ib = ns.GetDefaultFolder(olFolderInbox)
MsgBox SenderAddress(oFolder.Items(2))
End Sub
accessguy52