0

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
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • Just a minor possible error you may encounter. `For i = 0 To UBound(arr)` should be `For i = 0 To UBound(arr) - 1` – PatricK Apr 24 '14 at 03:08

1 Answers1

0

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

set m = m.Move(A) 
m.Display
Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78