Welcome to the fracta.net forum!

Share your coding ideas or ask questions.

Question Excel VBA Get outlook current user email address and full name

More
12 years 11 months ago #11 by roller
To get the current user name and email address from Outlook (I am using Exchange Server) you can try this code.

I used it in an Excel macro to pull the current user name and email address from Outlook. Before you run the code go to the VBA editor tools menu and add a reference to Microsoft Oulook 12.0 Object Library.


Sub one()
Dim objNS As Outlook.Namespace
Set objNS = Outlook.GetNamespace("MAPI")

msgbox objNS.Session.CurrentUser
msgbox objNS.Session.CurrentUser.AddressEntry.GetExchangeUser.PrimarySmtpAddress

end sub

Please Log in or Create an account to join the conversation.

Time to create page: 0.762 seconds
Powered by Kunena Forum