T
tmountjr
I'm writing (or trying to write) some code in Excel VBA to extract the
current logged-in user's email address from Outlook. I figured out how
to go through the namespace and access the currentuser:
Sub test()
Dim a As Recipient
Set a = Outlook.Application.GetNamespace("MAPI").currentUser
MsgBox a.AddressEntry.Address
End Sub
This returned a cryptic string that I can parse and bring to a usable
email address, but the problem is that it comes up with message saying
that it needs special permission to access the information. The error
box that comes up is: "A program is trying to access e-mail addresses
you have stored in Outlook. Do you want to allow this?" I could't find
anything in the security informatino to stop that from coming up. I
need this to be seamless so it can fit in an automated process. Is this
the best way to retrieve an email address from a login, and if so, how
do I stop that message from coming up?
current logged-in user's email address from Outlook. I figured out how
to go through the namespace and access the currentuser:
Sub test()
Dim a As Recipient
Set a = Outlook.Application.GetNamespace("MAPI").currentUser
MsgBox a.AddressEntry.Address
End Sub
This returned a cryptic string that I can parse and bring to a usable
email address, but the problem is that it comes up with message saying
that it needs special permission to access the information. The error
box that comes up is: "A program is trying to access e-mail addresses
you have stored in Outlook. Do you want to allow this?" I could't find
anything in the security informatino to stop that from coming up. I
need this to be seamless so it can fit in an automated process. Is this
the best way to retrieve an email address from a login, and if so, how
do I stop that message from coming up?