VBA Outlook Contacts problem

Discussion in 'Microsoft Outlook VBA Programming' started by michal_e, Jun 22, 2012.

  1. michal_e

    michal_e

    Joined:
    Jun 22, 2012
    Messages:
    1
    Likes Received:
    0
    Hi,

    I'm beginner in the VBA, so I know that it's could be silly problem, but I unfortunately I can't find any solution. I simply want to move every contacts from default folder ("Contacts") to another created be my (for example "Archive Contacts"). Its nessesary for me to run another script written by another person. So i write this:

    Sub copy_all()

    Dim NM As Outlook.Namespace
    Dim Oul As New Outlook.Application
    Dim currentItem As Object
    Dim currentContact As Outlook.ContactItem
    Dim contactFolder As Outlook.Folder
    Dim newFolder As Outlook.Folder




    Set NM = Oul.GetNamespace("MAPI")
    Set contactFolder = NM.Folders(1).Folders("Contacts")

    Set newFolder = contactFolder.Folders.Add("Moja_kopia_kontaktow")

    For Each currentItem In contactFolder.Items
    If (currentItem.Class = olContact) Then
    Set currentContact = currentItem

    currentContact.Move (newFolder)

    End If

    Next


    End Sub


    But I get error from Debugger that: "Object is required", I dont know what I'm doing wrong:(

    I would be very helpful for any advice and help
    Greets
     
    michal_e, Jun 22, 2012
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marc

    Vba mapping from Access 2002 fields to outlook 2002 (contacts) ?

    Marc, Feb 12, 2004, in forum: Microsoft Outlook VBA Programming
    Replies:
    1
    Views:
    348
    Ken Slovak - [MVP - Outlook]
    Feb 12, 2004
  2. Céline Brien

    VBA Outlook 2000 Delete contacts by categorie

    Céline Brien, Apr 13, 2004, in forum: Microsoft Outlook VBA Programming
    Replies:
    4
    Views:
    758
    Céline Brien
    Apr 15, 2004
  3. Guest

    Update Outlook Contacts on a Different Computer Using VBA

    Guest, Jun 22, 2004, in forum: Microsoft Outlook VBA Programming
    Replies:
    3
    Views:
    326
    Ken Slovak - [MVP - Outlook]
    Jun 23, 2004
  4. Ken Slovak - [MVP - Outlook]

    Re: Add a Contacts folder to My contacts( "add to my contacts" action)

    Ken Slovak - [MVP - Outlook], Dec 12, 2008, in forum: Microsoft Outlook VBA Programming
    Replies:
    0
    Views:
    320
    Ken Slovak - [MVP - Outlook]
    Dec 12, 2008
  5. KeenAs

    2003 Outlook Contacts - how do I add text to multiple contacts ....

    KeenAs, Aug 18, 2009, in forum: Microsoft Outlook VBA Programming
    Replies:
    2
    Views:
    285
    KeenAs
    Aug 27, 2009
Loading...

Share This Page