VBA Outlook Contacts problem

Jun 22, 2012
Reaction score

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


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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question