David Fisco

03 Jul 2006

Background: Outlook's auto-complete feature for email address fields can be a big time saver. Unfortunately, Outlook considers business fax numbers to be valid "email addresses" unless the field begins with alpha characters.

Objective: To prefix all business fax numbers with "FAX: " so that Outlook does not try to use them as email addresses in auto-complete. The code will recognize fields already beginning with "FAX: " and ignore them. Therefore, the user can continue to enter business fax numbers as usual and run this code repeatedly to prefix Outlook contacts.

Requires: Outlook (I'm running 2002).

Assumptions: This code assumes the contacts are using the standard IPM.Contact form built into Outlook. (That is, the user is not using custom forms for contacts.) Note that changing your Outlook fax numbers to begin with alpha characters may disrupt your ability to fax from Windows.

To use: Copy the VBA below into your "ThisOutlookSession". Run the ChangeContactFax macro whenever needed.


Sub ChangeContactFax()
Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set ContactsFolder = olNS.GetDefaultFolder(olFolderContacts)
Set ContactItems = ContactsFolder.Items
For Each Itm In ContactItems
If Itm.MessageClass = "IPM.Contact" Then
If Itm.BusinessFaxNumber <> "" And
(InStr(1, Itm.BusinessFaxNumber, "FAX:") <> 1) Then
tempString = "FAX: " & Itm.BusinessFaxNumber
Itm.BusinessFaxNumber = tempString
End If
End If
End Sub