Mass re-population of "Display as" field?

  • Thread starter Thread starter Torrence Hammond
  • Start date Start date
T

Torrence Hammond

We recently upgraded to OL2003 from OL2000.
We share contacts in an Exchange Server public folder with over 1,000
entries. The Display As field, which I learned was introduced in OL2002,
has been populated with the email addresses of each contact. The boss would
prefer to have the full names there instead. I understand from previous
posts that these would have to be changed one at a time.

It seems, however, that if the contents of the Display As field are deleted,
the field is automatically re-populated in a Full Name (email address)
format, which we find more palatable. Is it possible to delete the contents
of the Display As field en mass, or is this also a one-at-a-time ordeal?

Thanks,
Torrence Hammond
 
This sounds like it will do exactly what my boss wants!
Unfortunately, I'm embarrassed to admit that I don't know what to do with
it. How do I execute this?

KePaHa said:
Here is a macro we used to look through the currently-selected folder and
change any non-null Display As fields LastName, FirstName:
Sub MacroName()
Dim fld As MAPIFolder
Dim objItem

Set fld = Application.ActiveExplorer.CurrentFolder
Set colContacts = fld.Items

For Each objItem In colContacts
If objItem.Class = olContact Then
With objItem
If .Email1Address <> "" Then
If .Email1DisplayName = .Email1Address Then
straddress = .LastName & ", " & .FirstName
.Email1DisplayName = straddress
End If
End If
If .Email2Address <> "" Then
If .Email2DisplayName = .Email2Address Then
straddress = .LastName & ", " & .FirstName
.Email2DisplayName = straddress
End If
End If
If .Email3Address <> "" Then
If .Email3DisplayName = .Email3Address Then
straddress = .LastName & ", " & .FirstName
.Email3DisplayName = straddress
End If
End If
If Not .Saved Then
.Save
End If
End With
End If
Next
End Sub

So, for each of the three email addresses in an OL Contact, it evaluates
whether it is null. If not, it evaluates whether the display name is the
same as the email address. If so, it changes the DisplayAs to LastName,
FirstName.
 
WOW!
This worked great, after I got past your Alt-F1 typo (should be Alt-F11).
We even got up the courage to edit the code to add the labels (Email),
(Email 2), and (Email 3), respectively, following the FirstNames in each
field.
Thank you very, very much!!!

KePaHa said:
Copy that code (from Sub to the End Sub). In Outlook, press Alt+F1 to
open the VB window. Paste that code into the VB window and then close it.
Now, navigate to the Contact folder you wish to run it against. Go into
Tools, Macro, Macros, and it will appear as a macro named "MacroName". Run
this macro.
You may want to create a dummy Contact folder with a few contacts who have
this display problem. Run the macro against this test folder first to
ensure it is doing what you want.
 
Back
Top