Solved

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

Posted on 2014-09-23
7
527 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 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