Solved

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

Posted on 2004-04-15
6
164 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Outlook Free & Paid Tools
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
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 Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

747 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

16 Experts available now in Live!

Get 1:1 Help Now