将个人联系人列表复制到公用文件夹

时间:2015-08-10 14:00:48

标签: vba outlook copy directory contact

我制作了将联系人列表复制到公用文件夹的代码,但如果我不在联系人源代码中,则无效。

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

    objItem.Move objDestFolder

    Set objDestFolder = Nothing
End Sub

错误来自:

Set objItem = Application.ActiveExplorer.Selection.Item(1)

1 个答案:

答案 0 :(得分:0)

这是正确的 - 您的代码假定选择了要移动的项目。它做了它应该做的事情。

\你还想做什么?