Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88066

How to get info from the Initials field in the oulook addressbook with excel vba

$
0
0

I am a clerk and thought myself a little excel-vba in order to automate some tasks in the office.

However, while "coding" I stumbled upon the problem, that I can't retrieve information stated within the Initials field from the Outlook addressbook with vba. When you click on an entry in the Outlook addressbook, a pop-up window appears with the user information. With vba I could easily access all fields except the Initials field.

Here is the window with the field indicated in red AddressBookInformationJohnDoe

One script I wrote, extracts information of an employee in my company and copies it in the cells next to the employee's name. (See the simplified code below. Code that obviously does not work is commented out and ends with a question mark.)

Sub GetInfoUserShort()


Dim olApp           As Outlook.Application
Dim olNS            As Outlook.Namespace
Dim olRecip         As Outlook.Recipient

Dim Cell            As Range
Dim NameEmpl        As String
Dim Company         As String
Dim Initials        As String

NameEmpl = LCase(Trim(ActiveCell.Value))

Set olApp = CreateObject("Outlook.Application")
Set olNS = olApp.GetNamespace("MAPI")

Set olRecip = olNS.CreateRecipient(NameEmpl)
olRecip.Resolve

Company = olRecip.AddressEntry.GetExchangeUser.CompanyName
'Initials = olRecip.AddressEntry.GetExchangeUser.Initials ?

    ActiveCell.Offset(0, 1).Value = Company
    'ActiveCell.Offset(0, 2).Value = Initials ?

End Sub

However, within GetExchangeUser I can't find an object for the initials field. Is there an other way to extract the information?

I have seen similar questions in this forum, but could not quite follow the proposed answers.

Also, I should mention that the problem can't be solved by using the first letters of the name. The company gives every employee a specific abbreviation, comparable to an ID, and this abbreviation is stored in the Initials field.


Viewing all articles
Browse latest Browse all 88066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>