Outlook permits you to input three addresses to all contacts – Business, Home and Other Address, among which you can select one as mailing address. Now, if you wish to batch set a specific type of address as the mailing address for all contacts, you can use the method introduced in this article.
By default, in Outlook, the first address field you enter for a contact will set as the mailing address. In this case, the mailing addresses of all contacts may be in the different address fields. At present, if you would like to bulk set all contacts’ mailing addresses as a specific type of address, such as Home Address, you can use the following way.
Batch Set a Specific Type of Address as the Mailing Address for All Contacts
- At the very outset, start your Outlook application.
- Then, press “Alt + F11” key button to access Outlook VBA editor.
- Next, put the following VBA code into a module that is not being used.
Sub BatchChangeAllContactsMailingAddresses() Dim objStore As store Dim objFolder As Folder 'Process all stores in your Outlook For Each objStore In Application.Session.Stores For Each objFolder In objStore.GetRootFolder.Folders If objFolder.DefaultItemType = olContactItem Then Call ProcessFolders(objFolder) End If Next Next MsgBox "Completed!", vbInformation + vbOKOnly End Sub Sub ProcessFolders(ByVal objCurFolder As Folder) Dim objItem As Object Dim objContact As ContactItem 'Change the mailing address to home address field For Each objItem In objCurFolder.Items If objItem.Class = olContact Then Set objContact = objItem On Error Resume Next With objContact If .HomeAddress <> "" Then .MailingAddress = .HomeAddress .Save End If End With End If Next 'Process all subfolders recursively If objCurFolder.Folders.Count > 0 Then For Each objSubFolder In objCurFolder.Folders Call ProcessFolders(objSubFolder, strList) Next End If End Sub
- After that, change the mailing address line as per your needs according to the comments in the code.
- Finally, you can run this macro right now.
- First, click in the “BatchChangeAllContactsMailingAddresses” subroutine.
- Then, press “F5” key button.
- When the macro finishes, you can check the contacts’ mailing addresses. They must be changed as per your code.
Fix Repulsive PST Errors
When it comes to Outlook program, many users will come up with its excellent and myriad functions. However, in the meantime, it is an unquestioned fact that Outlook is prone to errors and corruption. That has plagued users for a long time. Yet, there is a mighty solution which can prevent it. What users can do is to keep well-prepared. For instance, you have to back up PST file at regular intervals. In addition, you had better keep a powerful fix tool nearby, like DataNumen Outlook Repair. It can repair Outlook issues like a cork.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including recover mdf and outlook repair software products. For more information visit www.datanumen.com