Outlook 2013 Macro - Find Text String in Outlook Contact Body and delete the string

I am looking for a way to remove an unwanted text string in the Notes (Body) section of outlook contacts

I have a vba macro that pages through all contacts and tried to use this code but it isn't working can anybody help?

                If InStr(1, .Body, "Facility Condition Assessment EBlast 09-03-2014 Test Run 01") > 0 Then
                    .Body = Replace(.Body, "==============^pFacility Condition Assessment EBlast 09-03-2014 Test Run 01", "")
                    BodyUpdtCnt = BodyUpdtCnt + 1
                End If

Thanks
rogerdjrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Calvin PaxsonPremier Services Technical Support ManagerCommented:
Export the contacts to csv, open with excel, use find replace to replace with unwanted string with nothing, import contacts back.  This may be far easier than troubleshooting your vba macro and should work very well.
0
David LeeCommented:
Hi, rogerdjr.

Add .Save on the line after the Replace.
0
rogerdjrAuthor Commented:
Bluedevilfan

I did have .save just after the code snippet I sent


As for the csv option - I guess it would work, but not the solution I was hoping for thanks
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Calvin PaxsonPremier Services Technical Support ManagerCommented:
If you are doing this once than the CSV option may be less work however if you need to repeat the process against 10 or more address books doing it programatically would potentially save some time.  The more address books involved the better the macro starts to look.
0
David LeeCommented:
rogerdjr,

Then the code should work assuming that the text you're searching for and the text you're replacing both exist.  Do a simple test.  Create a contact and put "string1" and "string2" in the body.  Save the contact.  Now, modify your code to look for "string1" and if found replace "string2" with nothing.  Run the code and see if it works.  If it does, then the problem isn't the code, it's the string you're looking for or the string you're replacing.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rogerdjrAuthor Commented:
I'll test it over the weekend
0
rogerdjrAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for rogerdjr's comment #a40344040

for the following reason:

Thanks - works perfectly - sorry it took so long to test
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.