Get Current User

W

wawa

Hi

How to read out the current user of Outloo
to use it in a code for my userdefined form

I tried this

Set myOlApp = CreateObject("Outlook.Application"
Set myNameSpace = myOlApp.GetNameSpace("MAPI"
MsgBox myNameSpace.CurrentUser.Nam

and this
Set myNameSpace = Application.GetNameSpace("MAPI"
MsgBox myNameSpace.CurrentUser.Nam

The response is in both cases "unkown".
What can be the reason
Or are there other ways to get the current user

User = ???

Thank
 
J

jbjim

if you replace currentuser.name with currentuser.address do you get the
current eamil address? The reason I ask is because of exchange server. If the
outlook default account is exchange server, then that is the problem.
 
R

Rick Newton

This single line works like a charm for me -- Exchange 2003 & Outlook
2003 -- on my forms (obviously there is a DIM statement elsewhere):


strUName = UCase(Application.GetNameSpace("MAPI").CurrentUser)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top