Usage of Outlook data via VBA in Excel

W

Winfried

Hi,

I find no matching link for my small problem. I'm using Windows XP
and
Office 2003 with an Exchange server in the background. The user name
to log into Windows is the same name as for Outlook/Exchange.


In an Excel application I have a formular with some data. One of the
data shall be the first name, the last name and the phone numer of
the
user who just opened my Excel application. For comfort reasons I want
to fill these fields automatically by default. The mentioned data are
available via Outlook. When I enter in Outlook a name in field "To:"
and do a douuble-click on the name I get the required information.


I'm very sure that there has to be a small solution that can be used
within Excel/VBA that does the following:
- get the current Windows Loginname (could be done via VBA command
environ("USERNAME"))
- with this piece of information find the first name, last name
phone
numer of this user (from the outlook address book) and store this
information in three variables.


In our firm we use Outlook 2000 as well as Outlook 2003. The best
would be not to set any references in VBA via "Tools | reference" so
that this solution runs with both Outlook versions.


I hope that someone can help me.


Thanks in advance
Winfried
 
W

Winfried

Hi Nick,

Inside VBA the VBA command "environ" -environ ("USERNAME")- really
works fine and gives me the Windows login name. Do have "THE" link
what helps me to get the required Outlook information for VBA inside
Excel? That would be great!!!

Winfried
 
N

NickHK

Winfried,
Check the VBA Help in Outlook for "Find Method".
So I assume your contacts have a field of "Username", so you can find their
real name and phone number ?

NickHK
 

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