Results 1 to 9 of 9
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delete Contacts before Import? (O2k SP-3 (9.0.6627) WinXP SP-2)

    What is the best way to delete all contacts prior to an import?

    Thanks, John

  2. #2
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete Contacts before Import? (O2k SP-3 (9.0.

    Edit > Select All > Delete... ?

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete Contacts before Import? (O2k SP-3 (9.0.

    Thanks

    When I originally tried this the focus was in one of the contacts so it won't select all

    How would I do this in code Macro/VBA?

    Thanks, John

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

    Re: Delete Contacts before Import? (O2k SP-3 (9.0.

    The following macro will remove ALL contacts from your Contacts folder. Be careful!

    Sub RemoveContacts()
    Dim nsp As NameSpace
    Dim fld As MAPIFolder
    Dim its As Items
    Dim i As Long
    Set nsp = GetNamespace("MAPI")
    Set fld = nsp.GetDefaultFolder(olFolderContacts)
    Set its = fld.Items
    For i = its.Count To 1 Step -1
    its.Remove i
    Next i
    Set its = Nothing
    Set fld = Nothing
    Set nsp = Nothing
    End Sub

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete Contacts before Import? (O2k SP-3 (9.0.

    Hi Hans

    Is this my Contact folder?

    Will the code delete the contacts in outlook.pst?

    Thanks, John

    Cocuments and SettingsJohnLocal SettingsApplication DataMicrosoftOutlook
    imap.aol,com-00000005.pst
    imap.aol.com-0000000b.pst
    imap.aol.com-0000000c.pst
    imap.aol.com-00000008.pst
    imap.aol.com-00000009.pst
    imap.aol.com (1)-00000007.pst
    outlook.pst

  6. #6
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Delete Contacts before Import? (O2k SP-3 (9.0.

    It will delete the Contacts in your default Contacts Folder, the one created by Outlook when your PST was first created. If you have multiple Contact Folders an easy way (for me to write the code <img src=/S/grin.gif border=0 alt=grin width=15 height=15> <img src=/S/snore.gif border=0 alt=snore width=32 height=15>) is this modification to Hans' code:

    Sub RemoveContacts()
    Dim nsp As NameSpace
    Dim fld As MAPIFolder
    Dim its As items
    Dim i As Long
    Set nsp = GetNamespace("MAPI")
    Set fld = nsp.PickFolder
    Set its = fld.items
    If fld.DefaultItemType = olContactItem Then
    For i = its.Count To 1 Step -1
    its.Remove i
    Next i
    Else
    MsgBox fld.Name & " is not a Contacts Folder"
    End If
    Set its = Nothing
    Set fld = Nothing
    Set nsp = Nothing
    End Sub

    I have a function that will loop through all information stores and folders, but it adds a lot of code, and I like the ability to choose Folders.
    -John ... I float in liquid gardens
    UTC -7ąDS

  7. #7
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Delete Contacts before Import? (O2k SP-3 (9.0.

    If you are using a table view, it can be hard to get the insertion point out of a field. Try using a view like Address Cards to do your select all.

  8. #8
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Delete Contacts before Import? (O2k SP-3 (9.0.

    <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29> If there's a card icon in the table view, click on it/them. And if you don't have the card icons in a Table View, add 'em back in! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    -John ... I float in liquid gardens
    UTC -7ąDS

  9. #9
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete Contacts before Import? (O2k SP-3 (9.0.

    Hi Guys

    Thanks for all your help

    John

Posting Permissions

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