Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Update Outlook Contact Item using VBA

239 views
Skip to first unread message

Michael Ryle

unread,
Jun 9, 2004, 1:14:01 PM6/9/04
to
I use the following code to create an outlook contact item:

Dim olApp As Outlook.Application
Dim olNewContact As Outlook.ContactItem

Set olApp = CreateObject("Outlook.Application")
Set olNewContact = olApp.CreateItem(olContactItem)

With olNewContact

... set data fields ...

.Save

End With

Does anyone know how can I use VBA to UPDATE a contact item once it's been created? Thanks.

--
Michael Ryle
North Eastham, MA

Sue Mosher [MVP-Outlook]

unread,
Jun 9, 2004, 2:06:13 PM6/9/04
to
You'd use

... set data fields ...

MyContact.Save

The potentially hard part is getting MyContact in the first place. You
didn't say *which* contact you wanted to update.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Michael Ryle" <Micha...@discussions.microsoft.com> wrote in message
news:2F337928-7CD2-4239...@microsoft.com...

Michael Ryle

unread,
Jun 9, 2004, 2:18:02 PM6/9/04
to
Sue,

You're right, I didn't say, because I don't know what identifies a contact, what the "key" is, and how to get currency on the item I want to update. That is the part I don't know. If I had some clue as to where it was documented I wouldn't have to ask.

--
Michael Ryle
North Eastham, MA

Sue Mosher [MVP-Outlook]

unread,
Jun 9, 2004, 2:36:01 PM6/9/04
to
Again, there's not enough context to your question to provide a direct
answer. Do you want the contact named "Michael Ryle"? What if there are two?
Each Outlook item has a unique EntryID property, but it's a long string
you're not likely to memorize. Perhaps you should explain just what
application you have in mind.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Michael Ryle" <Micha...@discussions.microsoft.com> wrote in message

news:AB6DB873-81AA-448F...@microsoft.com...


> Sue,
>
> You're right, I didn't say, because I don't know what identifies a
contact, what the "key" is, and how to get currency on the item I want to
update. That is the part I don't know. If I had some clue as to where it
was documented I wouldn't have to ask.
>
> --
> Michael Ryle
> North Eastham, MA
>
>
> "Sue Mosher [MVP-Outlook]" wrote:
>
> > You'd use
> >
> > ... set data fields ...
> > MyContact.Save
> >
> > The potentially hard part is getting MyContact in the first place. You
> > didn't say *which* contact you wanted to update.
> >

Michael Ryle

unread,
Jun 9, 2004, 2:54:02 PM6/9/04
to
On Monday, I enter personal information (name, phone, email, etc.) for a new client in an Access form.

When the Access form is closed, VBA code copies (i.e. propagates) this information into Outlook by creating a new contact item as described below.

On Wednesday, the client tells me he has a new email address and I change it in Access. How do I update the corresponding contact item?

This presumes there are no duplicates in the Outlook contacts folder (or there aren't supposed to be).

Sue Mosher [MVP-Outlook]

unread,
Jun 9, 2004, 4:48:00 PM6/9/04
to
After you initially create the Outlook contact item and save it, get its
EntryID property and store it in your database. When you need to do an
update, you can call Namespace.GetItemFromID to retrieve the contact from
the EntryID.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Michael Ryle" <Micha...@discussions.microsoft.com> wrote in message

news:AA0E3C48-36D3-4C55...@microsoft.com...

Michael Ryle

unread,
Jun 10, 2004, 5:37:02 PM6/10/04
to
Thanks, Sue.

I'll give it a try when I get a chance.

--
Michael Ryle
North Eastham, MA

0 new messages