Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Mar 2003
    Location
    Ilkeston, Derbyshire
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Outlook contacts (Access 2000)

    I'm using some code I've tweaked a bit from Helen Feddema's site that adds contacts from an Access query to an Outlook Contacts folder. Work's a treat.This process is to be used to update our mobile phones with contact info and I need to empty the contents of the destination Contacts folder before running Helen's code.

    Anyone know how I can do this in code from within Access?

    TIA
    Mark

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Outlook contacts (Access 2000)

    I assume you already have an Outlook.Application object. Use that in the code below instead of creating a new one. In this example, all items in a subfolder "My Contacts" within the standard Contacts folder are deleted. You can adapt it to your situation. Note that this code does not quit Outlook, since I assume that you want to do more things in it.

    Dim olApp As Outlook.Application
    Dim olNsp As Outlook.NameSpace
    Dim olFld As Outlook.MAPIFolder
    Dim i As Long

    Set olApp = CreateObject("Outlook.Application")
    Set olNsp = olApp.GetNamespace("MAPI")
    Set olFld = olNsp.GetDefaultFolder(olFolderContacts).Folders(" My Contacts")
    For i = olFld.Items.Count To 1 Step -1
    olFld.Items.Remove i
    Next i

    Set olFld = Nothing
    Set olNsp = Nothing
    Set olApp = Nothing

  3. #3
    Star Lounger
    Join Date
    Mar 2003
    Location
    Ilkeston, Derbyshire
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Outlook contacts (Access 2000)

    Thanks, Hans. Just the job.

    Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •