![]() |
Usage of Outlook data via VBA in Excel
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 |
Usage of Outlook data via VBA in Excel
Winfried,
Not sure how you get from the Windows UserName to the personal details in an Address Book; maybe use this in Windows: http://vbnet.mvps.org/code/network/netusergetinfo.htm After that, using Automation on Outlook to get the PhoneNumber. Sounds like you want to use Late Binding also. http://www.google.co.uk/search?hl=en...e+Search&meta= NickHK "Winfried" wrote in message oups.com... 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 |
Usage of Outlook data via VBA in Excel
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 |
Usage of Outlook data via VBA in Excel
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 "Winfried" wrote in message oups.com... 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 |
All times are GMT +1. The time now is 01:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com