Microsoft Outlook considers fax numbers to be valid e-mail addresses. If you want to be able to send both e-mails and faxes from Outlook, there's no solution to this issue.
If you are keeping the fax numbers just as a matter of record, though, and don't use them in Microsoft Outlook, then you can choose one of the non-fax phone number fields to store the fax number information. Unfortunately, you can't change the names of the built-in fields; you would need to remember which field contains fax numbers.
Another approach is to put text in front of the fax number, such as "W: " for a work fax or just "Fax:"; this causes the number to disappear from the Outlook Address Book, but keeps it easy to see the number in the contact record or Contacts folder. The tools listed below add a prefix automatically and remove it when you need to dial the number.
Macro to prefix Fax numbers
You can run the following macro to refix fax numbers with Fax: so they won't show in the address book.
Replace BusinessFaxNumber with HomeFaxNumber or OtherFaxNumber if you need to hide other fax numbers.
Removing the Fax prefix from numbers requires more complicated VBA code to strip only the prefix and is more prone to error. Because of this we recommend using an addin that can toggle the prefix off and on.
Public Sub HideFaxNumbers() Dim objOL As Outlook.Application Dim objNS As Outlook.NameSpace Dim objContact As Outlook.ContactItem Dim objItems As Outlook.Items Dim objContactsFolder As Outlook.MAPIFolder Dim obj As Object Dim olfax As String On Error Resume Next Set objOL = CreateObject("Outlook.Application") Set objNS = objOL.GetNamespace("MAPI") Set objContactsFolder = objNS.GetDefaultFolder(olFolderContacts) Set objItems = objContactsFolder.Items For Each obj In objItems 'Test for contact and not distribution list If obj.Class = olContact Then Set objContact = obj With objContact If .BusinessFaxNumber <> "" Then olfax = .BusinessFaxNumber .BusinessFaxNumber = "Fax: " & olfax End If .Save End With End If Err.Clear Next Set objOL = Nothing Set objNS = Nothing Set obj = Nothing Set objContact = Nothing Set objItems = Nothing Set objContactsFolder = Nothing End Sub
Remove Fax: Prefix
To remove Fax: from the Fax number, replace the If block with this.
If InStr(.BusinessFaxNumber, "Fax: ") Then .BusinessFaxNumber = Replace(.BusinessFaxNumber, "Fax: ", "") End If .Save
If you have duplicate fax prefixes (caused by running the macro more than once), or to prevent duplicates when you update contacts, use this to remove and replace the prefix:
If InStr(.BusinessFaxNumber, "Fax: ") Then .BusinessFaxNumber = Replace(.BusinessFaxNumber, "Fax: ", "") End If .Save If .BusinessFaxNumber <> "" Then olfax = .BusinessFaxNumber .BusinessFaxNumber = "Fax: " & olfax End If .Save
How to use the HideFaxNumbers Macro Tutorial
How to use macros
First: You will need macro security set to low during testing.
To check your macro security in Outlook 2010 or 2013, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, it’s at Tools, Macro Security.
After you test the macro and see that it works, you can either leave macro security set to low or sign the macro.
Open the VBA Editor by pressing Alt+F11 on your keyboard.
To put the code in a module:
- Right click on Project1 and choose Insert > Module
- Copy and paste the macro into the new module.
More information as well as screenshots are at How to use the VBA Editor
More Information
- Enabling the Outlook Address Book and Contacts folder
- OL2002- Contacts with Both an E-Mail Address and a Fax Number Are Listed Twice When You Select an E-mail Recipient
Hi Diane,
Thank you for posting this information. The macro worked great for my default contact folder. How would I modify this to accommodate a ShareFile contacts library? I have a Sharefile library listed under Other Contacts in Outlook, The Sharefile contacts are enabled to appear in my Outlook Address Book.
Thank you,
Craig
This tells it which folder to use:
Set objContactsFolder = objNS.GetDefaultFolder(olFolderContacts)
Change it to
Set objContactsFolder = Application.ActiveExplorer.CurrentFolder
Select the sharepoint contacts folder and run it.
I have several subfolders in my Contact folder. How can I get this to apply to those contacts as well?
Hey, i had the same problem with the subfolders and a friend modified the macro and it worked flawlessly. Here it is
Public Sub HideFaxNumbers()
Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objContact As Outlook.ContactItem
Dim objItems As Outlook.Items
Dim objContactsFolder As Outlook.MAPIFolder
Dim obj As Object
Dim olfax As String
On Error Resume Next
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
Set objContactsFolder = objNS.GetDefaultFolder(olFolderContacts)
Set objFolders = objContactsFolder.Folders
For Each objFolder In objFolders
Set objItems = objFolder.Items
For Each obj In objItems
'Test for contact and not distribution list
If obj.Class = olContact Then
Set objContact = obj
With objContact
If .BusinessFaxNumber "" Then
olfax = .BusinessFaxNumber
.BusinessFaxNumber = "Fax: " & olfax
End If
.Save
End With
End If
Err.Clear
Next
Next
Set objOL = Nothing
Set objNS = Nothing
Set obj = Nothing
Set objContact = Nothing
Set objItems = Nothing
Set objContactsFolder = Nothing
End Sub
Thanks for posting this. I notice the video states this is for default contact folder. Can this be changed to a public folder?
You can. You need to use olPublicFoldersAllPublicFolders and walk down the folders if the contacts folder is deeply nested. If it's near the top of the folder tree, you can this:
Set objContactsFolder = objNS.GetDefaultFolder(olPublicFoldersAllPublicFolders).folders("folder-name").folders("contacts-folder")
I have a user w/over 8k contacts & has this same issue. I don't know where I should put this code & how/when it runs. I assume I should copy & paste it in a text file & give it a .vba extension & save it where? Any help would be great. Thx!
I added a video tutorial to the page. Set macro security to low, press alt+F11 to open the editor or show the developer ribbon, right click on Project1 and choose Insert > Module. paste in the code and run. It may take a few minutes to run it on 8000 contacts. It'll save running in the title bar while its running.
Hi Diane, Thank you for taking the time to answer my question & the very helpful video. I ran into a problem though. After pasting the code in the vb editor I got this error message:
Compile Error:
End If without block If.
I believe its Line 30 Col 15. I made sure that it doesn't have a hidden space or formatting. Any ideas? I've come so close...
Is anything red? I'm not getting an error here - that error usually means there are too many End if lines and not enough If.
These are my 14 and 15:
End With
End If
That end if matches the if obj.class line and there is set of if/end if that checks the business number.
I pasted the code in VBA, and got an snytax error message. Anything else I need to do?
Any read lines? What line did it error on?
Nice idea, and piece of code.
I used your code inside a macro and deployed it in my company, now all of my contacts have FAX: as a prefix.
However in Outlook 2010 and 2007 which we use, the address book still shows the fax numbers.
Anything else I should try?
Regards
Chris
Are the contacts with fax: in your local contacts folder or the GAL? the fax prefix should remove them from the address book.