Log in

View Full Version : [SOLVED:] VBA - Outlook 2010 - Copy a contact list to a contact list in the public folder



bartoch
08-11-2015, 01:56 AM
Hello,

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 - test.com").Folders("all public folder").Folders("test")

objItem.Move objDestFolder

Set objDestFolder = Nothing
End Sub

gmayor
08-11-2015, 02:51 AM
See https://social.msdn.microsoft.com/Forums/en-US/03809184-5a88-4626-9639-607d3dc2db50/outlook-2010-copy-a-contact-list-to-a-contact-list-in-the-public-folder?forum=isvvba#585f3b39-d7dd-4e9b-8796-3ada23ecf4ea

bartoch
08-11-2015, 07:06 AM
thx a lot

donaldsims
08-19-2015, 06:25 AM
Very useful link!

David Cooper
04-20-2018, 03:54 AM
As I may see it is solved now, I only wanted suggest you a good way for it. I used the export mac mail to outlook more details (https://www.outlooktransfer.com/how-to-transfer-mac-mail-emails-to-outlook/) and others fetures are described on that page. But thanks to advices above, they are useful too. Besides I was searched this solving for my problem, for long, surfing on the blogs and others forums, I was lucky to find this way. So I just wanted to share this finding in case if somebody like me, will search this as well. My job maded me to look for it, and I'm pretty hapy that I found such a thing. For me now is useful not only for work, but for private emails export as well.