street address fields contain 0A0D

Status
Not open for further replies.

cimbian

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
A 'play' with some third party software left me with a corrupt (unbacked-up :() contacts list. Several exports/imports via CSV to/from Excel got me back to what looked to be an okay position... BUT... Now, I have found that some of the street address fields have 0A0D embedded within them and I could do with a way of removing them without exporting/editing/reimporting through Excel.

It has become an issue as I need to export some of the contacts to MailChimp for a mailing campaign.

Thoughts?
 
Assuming your text is now on a single line, after you make a backup you can try replacing the 0A0D in the text.

Code:
Private Sub ContactFolderItems_replace_0A0D()

Dim cFolder As folder
Dim cItem As Object
Dim i As Long

' 0A = Line feed
' 0D = Carriage return

Set cFolder = Session.GetDefaultFolder(olFolderContacts)

For i = 1 To cFolder.Items.count
 
    Set cItem = cFolder.Items(i)
 
    If cItem.Class = olContact Then
 
        ' there are other Address related properties - BusinessAddress
        ' https://msdn.microsoft.com/en-us/vba/outlook-vba/articles/contactitem-object-outlook
        If InStr(cItem.HomeAddress, "0A0D") Then
         
            'cItem.Display
            'Debug.Print cItem.HomeAddress
         
            ' Two lines
            cItem.HomeAddress = Replace(cItem.HomeAddress, "0A0D", vbLf & vbCr)
         
            ' or one line
            ' cItem.HomeAddress = Replace(cItem.HomeAddress, "0A0D", vbLf)
         
            ' or one line
            ' cItem.HomeAddress = Replace(cItem.HomeAddress, "0A0D", vbCr)
         
            'Debug.Print cItem.HomeAddress
         
            ' Save manually after confirming 0A0D is not a legitimate part of the address
            cItem.Display
            Exit For    ' Remove once solution is confirmed
         
            ' or autosave, instead of Display, once solution is confirmed
            ' cItem.Save
         
        End If
 
    End If

Next

End Sub
 
Thanks Niton. Much appreciated. :)
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
P Email address auto-completes work fine on laptop, but no longer on desktop Using Outlook 2
H Copying email address(es) in body of email and pasting in To field Outlook VBA and Custom Forms 1
P VBA to add email address to Outlook 365 rule Outlook VBA and Custom Forms 0
Rupert Dragwater How to permanently remove an email address Using Outlook 9
Bardiferous Weird Contacts Behavior - Can't find any in any address book, but they're in there Using Outlook 3
L Specific Incoming Email Address Immediately Deleted Using Outlook 2
L Unable to Use Alias as From Address Using Outlook 2
H Preventing the 'email address fetch from Exchange' crashing email reading code Exchange Server Administration 0
D multiple email accounts - why do I have to choose the "from" account address?? Using Outlook 2
whizzard Change FROM address based on TO or CC address Outlook VBA and Custom Forms 8
C Outlook FROM ADDRESS -Outlook.com and Android Using Outlook 1
O What would be the recommended way to change an email address (family member)? Using Outlook 0
L Checking Sender Email Address for trusted domain from list on intranet Outlook VBA and Custom Forms 4
J How do you disable address search box when typing @ in body of email? Using Outlook 0
Victor.Ayala Automated way to check the option "Show this folder as an email Address Book" Outlook VBA and Custom Forms 2
D Wrong email address in Outlook 2003 "From" tab in new outgoing emails Using Outlook 4
M Gmail address associated with Outlook on new phone Using Outlook 9
e_a_g_l_e_p_i Outlook 2010 How to set default email address for website links Using Outlook 3
O Same email address, same person, names in so many ways Using Outlook 4
R Capture Sender's Display name and Address Outlook VBA and Custom Forms 3
D auto forward base on email address in body email Outlook VBA and Custom Forms 0
N contact list seen in Contact folder but knot in Address book or when 'TO' button is clicked in new email Using Outlook 0
C WARNING - DO NOT USE AN OUTLOOK.COM ADDRESS FOR GOOGLE ACCOUNT RECOVERY EMAIL Using Outlook 10
D Outlook Address Book Using Outlook 0
Terry Sullivan Sender Field Displays My E-Mail Address, Not My Name Using Outlook 1
L Email with correct To address but displaying name of a related person Using Outlook 0
1 Incorrectly Setup a Rule at Domain level to not allow address from outside domain Exchange Server Administration 2
D Is a sub folder under contacts necessary to be able to name an Address Book? Using Outlook 1
A Outlook replies not using "delivered to" address in From Using Outlook 1
T "Words In Recipient's Address" Rule Causes Outlook To Stop Processing Rules Using Outlook 3
B Extracting email addresses from a folder - how to also get the name of the person the address is for? Using Outlook 5
W Replyin to the reply-to email address Outlook VBA and Custom Forms 0
M Changing the preferred order for "Put this entry in" list for adding new contacts to the Address Book Using Outlook 1
B Change from Address Outlook VBA and Custom Forms 0
D Renaming Address Book Using Outlook 3
J Sent Items Folder NOT Showing Correct From Email Address Using Outlook 0
J Outlook Reply > From > Other Email Address... > Address Not Showing in Sent Items... From Email Outlook VBA and Custom Forms 0
M PST import from Outlook 2007 to 2010 - Address Book contacts all in 1 group Using Outlook 4
C Outlook Autocomplete suggestions showing wrong person's name against an email address Using Outlook 0
O Address list - company and non-company ? Using Outlook 0
Healy Consultants Macro to remove inside organization distribution list email address when reply to all recepients Outlook VBA and Custom Forms 0
L Email not going to address displayed Using Outlook 4
B When sending an email, I am showing 2 of my address's Using Outlook 1
oliv- determine to which address an email has been sent Outlook VBA and Custom Forms 3
N Exporting IM Address field Using Outlook 2
R outlook address book search broken Using Outlook 2
M Screen Scrape Sender IP Address Outlook VBA and Custom Forms 6
S Outlook 2007 printing wrong email address at top of page Using Outlook 8
N Outlook 2016 Address Book lookup Using Outlook 9
B Looking to get the Recipient email address (or even the "friendly name") from an email I am replying to using VBA Outlook VBA and Custom Forms 4

Similar threads

Back
Top