View Single Post
Old 08-11-2015, 12:14 AM
bartoch bartoch is offline Windows 7 64bit Office 2010 64bit
Join Date: Aug 2015
Posts: 2
bartoch is on a distinguished road
Default VBA - Outlook 2010 - Copy a contact list to a contact list in the public folder

I have make a script for copy a contact list to a contact list in the public folder but if i'm not on the contact source , the macro don't work, i don't know why, thx.

I things the error come from:
Set objItem = Application.ActiveExplorer.Selection.Item(1)

Sub Movecopycontacts()

Dim objOutlook As Outlook.Application
Dim objNamespace As Outlook.NameSpace
Dim objSourceFolder As Outlook.MAPIFolder
Dim objDestFolder As Outlook.MAPIFolder
Dim objItem As ContactItem

Set objOutlook = Application
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objSourceFolder = objNamespace.GetDefaultFolder(olFolderContacts)
Set objItem = Application.ActiveExplorer.Selection.Item(1)
Set objDestFolder = objNamespace.Folders("Public folder -").Folders("all public folder").Folders("test")

objItem.Move objDestFolder

Set objDestFolder = Nothing
End Sub
Reply With Quote