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
Solved

How can I add information to the notes field for a selected group of contacts?

Posted on 2004-04-15
6
171 Views
Last Modified: 2010-04-08

I want to append a sentence to the beginning of the "notes" field of 100 contacts.  These contacts already have various items / bits of information in their notes field.  How can I ad this new bit of information to the entire group of selected contacts without losing the existing information in that field?
0
Comment
Question by:mycomac
  • 3
  • 3
6 Comments
 
LVL 13

Accepted Solution

by:
stefri earned 125 total points
ID: 10836718
Familiar with VBA?
Open VBA Editor (Alt F11)
Expand Project in left pane
Double click ThisOutlookSession

In the right window, cut & paste
Option Explicit
Sub appendMyString()
Dim co As Outlook.ContactItem
Dim bodyStr As String
Dim myStringToAppend as String

Dim colSelection As Outlook.Selection
Set colSelection = Application.ActiveExplorer.Selection
myStringToAppend =  "my string to be appended"   '<---Modify to your needs. If you need more than one line use the line below
myStringToAppend =  "my string to be appended" & vbCrLf & "with a new line"

If colSelection.Count = 0 Then
   Set colSelection = Nothing
   Exit Sub
End If
For Each co In colSelection
    bodyStr = co.Body
    co.Body =myStringToAppend &  vbCrLf  &  bodyStr
    co.Save
Next
End Sub

Goto your contacts folders, select the contatcs you want to append
Tools/Macro/Select appendMyString from the list then click Run

Try on one contact to check if it does what you want

Stefri
0
 

Author Comment

by:mycomac
ID: 10845221
This works fine.  Thanks.  

Is there a simple addition that would call a text box when the macro is run so the "Note" could be typed into the text box rather than having to edit the VBA code to change the "Note"?
0
 
LVL 13

Expert Comment

by:stefri
ID: 10845629
Here it goes:
if you click Cancel in the inputbos, nothing will be done
Lets say Notes text is: notesnotesnotes

Input text Example: my string is on one line
New Notes content will be:
my string is one line
notesnotesnotes

If in the string you input contains \n, a new line will be inserted
Input text Example: my string is on\ntwo lines
New Notes content will be:
my string is on
two lines
notesnotesnotes

Enjoy,

Option Explicit
Sub appendMyString()
Dim co As Outlook.ContactItem
Dim bodyStr As String
Dim myStringToAppend As Variant
Dim theRealString As String
Dim colSelection As Outlook.Selection
Set colSelection = Application.ActiveExplorer.Selection
myStringToAppend = InputBox("String to be prepended", "Your string")
    If myStringToAppend <> False Then
            theRealString = Replace(myStringToAppend, "\n", vbCrLf, 1, -1, vbTextCompare)
            If colSelection.Count = 0 Then
               Set colSelection = Nothing
               Exit Sub
            End If
            For Each co In colSelection
                bodyStr = co.Body
                co.Body = theRealString & vbCrLf & bodyStr
                co.Save
            Next
    End If
End Sub
0
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.

 

Author Comment

by:mycomac
ID: 10848735
This is perfect.  Thanks
0
 

Author Comment

by:mycomac
ID: 10848790
I'll be happy to offer more points for this one, but first want to ask if it's possible in a similar fashion as above.

Construct a macro that automatically appends the date and subject line of an e-mail message to the beginning of the "Notes" field for all of the contact records that are either in the "To:", "CC", or "BCC" box of the e-mail message (only if the e-mail address is associated with a contact in my Contacts or Global Address list).
0
 
LVL 13

Expert Comment

by:stefri
ID: 10848895
From GAL: you cant modify the properties for a user in the GAL
If OL200x,  did you try to swicch to Activities tab of a contact? Select Email from pulldow menu

Stefri
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
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…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

829 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