Editing notes in Contact using VBA

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

Hi All,

Hoping someone can help. I am trying to add a date and
note into the Notes section of a bunch of contacts (over
1000). I coded a macro that asks the user what they want
to add to notes and which Contact folder they want to do
this to. Problem is how to edit the notes to add these
lines in. The only thing I can find is how to read whats
in the notes. I have found out that the name for the
Notes section in Contact is actually called Body. I was
attempting to add the line using this line of code.

objContact.Body = strNotes where strNotes is a string
returned from an InputBox.

Anyone know how to do this?

Thanks in advance,
Dave
 
Thanks Sue but that didn't work. It seems to be more of a problem of
getting anything into the Contact notes section. I've even tried
objContact.Body = "test" but that didn't work. It must be something I'm
doing before that. I've included the whole VBA macro code. Maybe you'll
be able to see something there.

I am still plenty a newbie with VB and VBA so its a good possibility its
in the code I wrote before that.

Thanks,
Dave

Dim objApp As Application
Dim objFolder As MAPIFolder
Dim objContact As Outlook.ContactItem
Dim i As Integer
Dim strNotes As String
Dim objItem As Object



prompt$ = "Please type what you want to add to the notes section of
these contacts."

strNotes = InputBox(prompt$, "Add Notes")

i = 1

Set objApp = CreateObject("Outlook.Application")
Set objFolder = objApp.GetNamespace("MAPI").PickFolder
Set objItem = objFolder.Items.Item(i)
Set objContact = objItem


For Each objContact In objFolder (usually bombs here and says "Object
does not support property or method)
objContact.Body = strNotes objContact.Close olSave
Next

(when it bombs objContact.Body says "objContact.Body = "what" which I
put in this particular contacts notes so it reads it but I still can't
write to it)

(when it bombs strNotes says "test" because that is what I typed into
the InputBox when it pops up)

Any help here would be a great help. Would also give me a program I can
use in multiple ways to automate contact management.
 
Back
Top