Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / November 2003

Tip: Looking for answers? Try searching our database.

Linking Contacts

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lance - 20 Oct 2003 21:29 GMT
Hi all,

On the Outlook contact form, bottom left corner there is a
contacts button that lets you link other contacts to the
contact displayed on the form.

How do I link contacts like this using VBA?  I'm trying to
use the add method of the Links property but it is not
working(code below runs from an access database).

Can someone please advise?

Thanks,
Lance

Sub LinkContactTest()

   Dim ol As Outlook.Application
   Set ol = Outlook.Application
   
   Dim ns As Outlook.NameSpace
   Set ns = ol.GetNamespace("MAPI")
   
   Dim fld As MAPIFolder
   Set fld = ns.GetDefaultFolder(olFolderContacts)

   Dim cnt As Outlook.ContactItem
   
   For Each cnt In fld.Items
       If cnt.FullName = "John Smith" Then
           cnt.Links.Add ns.GetDefaultFolder
(olFolderContacts).Items(2)
           MsgBox ns.GetDefaultFolder
(olFolderContacts).Items(2).FullName
       End If
   
   Next
Sue Mosher [MVP] - 08 Nov 2003 03:10 GMT
Links.Add is the correct method. What precisely isn't working? I don't see any statement that saves the item.
Signature

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

> Hi all,
>
[quoted text clipped - 33 lines]
>    
>     Next
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.