title: VBA Microsoft Outlook Mail Handling - Adding Another Case
body: <p>In 'ThisOutlookSession' I have this sub which catches a specific attachment. How can I add another condition whereby another particular mail item and attachment is picked up? </p>
  
  <pre><code>Private Sub Items_ItemAdd(ByVal item As Object)
  
      On Error GoTo ErrorHandler
  
      'Only act if it's a MailItem
      Dim Msg As Outlook.MailItem
      If TypeName(item) = "MailItem" Then
          Set Msg = item
  
          'Change variables to match need. Comment or delete any part unnecessary.
          If (Msg.SenderName = "Sender") And _
              (Msg.Subject = "Sub") And _
              (Msg.Attachments.Count &gt;= 1) Then
  
              'Set folder to save in.
              Dim olDestFldr As Outlook.MAPIFolder
              Dim myAttachments As Outlook.Attachments
              Dim Att As String
  
              'location to save in.  Can be root drive or mapped network drive.
              Const attPath As String = "Z:\Folder\Folder\"
  
              ' save attachment
              Set myAttachments = item.Attachments
              Att = myAttachments.item(1).DisplayName
              myAttachments.item(1).SaveAsFile attPath &amp; Att
  
              ' mark as read
              Msg.UnRead = False
          End If
  
      End If
  
  ProgramExit:
      Exit Sub
  
  ErrorHandler:
      MsgBox Err.Number &amp; " - " &amp; Err.Description
      Resume ProgramExit
  End Sub
  </code></pre>