Solved

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

Posted on 2014-09-23
7
511 Views
Last Modified: 2014-10-09
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
0
Comment
Question by:rogerdjr
  • 3
  • 2
  • 2
7 Comments
 
LVL 2

Expert Comment

by:Calvin Paxson
ID: 40339877
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
 
LVL 76

Expert Comment

by:David Lee
ID: 40340069
Hi, rogerdjr.

Add .Save on the line after the Replace.
0
 

Author Comment

by:rogerdjr
ID: 40340377
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 2

Expert Comment

by:Calvin Paxson
ID: 40340396
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
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 40340483
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
 

Author Comment

by:rogerdjr
ID: 40344040
I'll test it over the weekend
0
 

Author Comment

by:rogerdjr
ID: 40370953
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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Email signatures have numerous marketing benefits. Here are 8 top reasons to turn your email signature into a marketing channel.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now