VBA outlook 2010 move

帅比萌擦擦* 提交于 2019-12-25 07:24:44

问题


m.display works but m.move(A) does not.

The folder exist.

Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
    Dim arr() As String
    Dim myInbox As Outlook.Folder
    Dim A As Outlook.Folder
    Set myNameSpace = Application.GetNamespace("MAPI")
    Set myInbox = 
           myNameSpace.GetDefaultFolder(olFolderInbox)
    Set A = myInbox.Folders("A")
    Dim i As Integer
    Dim m As MailItem
    On Error Resume Next
    arr = Split(EntryIDCollection, ",")
    For i = 0 To UBound(arr)
    Set m = Application.Session.GetItemFromID(arr(i))

    If m.SenderEmailAddress = "notifications@transcore.com" Then
        'MsgBox (m.Body)
        m.Display
        m.Move (A)
    End If

    Next
End Sub

回答1:


Move is a function, not a sub. Move the message first, then display it:

set m = m.Move(A) 
m.Display


来源:https://stackoverflow.com/questions/23154740/vba-outlook-2010-move

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!