Solved

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

Posted on 2014-09-23
7
559 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
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…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

734 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