PDA

View Full Version : Access/Outlook



danitrin
01-24-2005, 12:13 PM
I'm trying to find the code to pull the sender's name from an email sent via access. Each time an email is sent, it is logged into access, indicating who it went to and when. I need to also be able to log who the email was sent from. can anyone get me started on this? everything i have found so far involves incoming emails and not outgoing. thks!

flavo
02-17-2005, 01:57 AM
Hey danitrin!

Try this.. prints username to the immediate window (Ctrl + g to open this in VBA mode)

Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Set objApp = New Outlook.Application
Set objNS = objApp.GetNamespace("MAPI")
Debug.Print objNS.CurrentUser

'clean up
Set objApp = Nothing
Set objNS = Nothing

Dave :-)

danitrin
02-17-2005, 07:57 AM
That worked perfect.....thank you so much!

flavo
02-17-2005, 11:31 AM
glad to help mate!