title: Loop to next when there is no attachment to be added to an email
body: <p>I have code to send bulk emails to different recipients and with two attachments.<br />
  One PDF and one Excel file is attached to each mail, when available.</p>
  <p>When the macro does not find the PDF or Excel that it should attach, it sends the email without any attachment.</p>
  <p>I would like to skip/delete emails when no attachment is found.<br />
  If only the PDF or only the Excel, then it is fine.</p>
  <p>I need to skip to the next email without sending the current one, if the current one has no attachment.</p>
  <pre class="lang-vb prettyprint-override"><code>Option Explicit
  Public Sub SendScorecards()
      Dim olApp As Object
      Dim olMail As Object
      Dim olRecip As Object
      Dim olAtmt As Object
      Dim olAtmt2 As Object
      Dim iRow As Long
      Dim Recip As String
      Dim Subject As String
      Dim Atmt As String
      Dim Atmt2 As String
      
      iRow = 2
      
      Set olApp = CreateObject(&quot;Outlook.Application&quot;)
      Dim Sht As Worksheet
      Set Sht = ThisWorkbook.Worksheets(&quot;Sender&quot;)
      
      Do Until IsEmpty(Sht.Cells(iRow, 1))
      
          Recip = Sht.Cells(iRow, 1).Value 'Email addresses
          Subject = Sht.Cells(iRow, 2).Value 'Subject of the email, like &quot;UK_Vendor name_Operations Scorecard&quot;
          Atmt = Sht.Cells(iRow, 3).Value 'PDF attachment path
          Atmt2 = Sht.Cells(iRow, 4).Value 'Excel attachment path
      
          Set olMail = olApp.CreateItem(0)
      
          With olMail
              Set olRecip = .Recipients.Add(Recip)
              .Subject = Subject
              .Body = Sht.Cells.Range(&quot;J2&quot;) 'Blurb to be added in the body of the emails
              .Display
              Set olAtmt = .Attachments.Add(Atmt)
              Set olAtmt2 = .Attachments.Add(Atmt2)
              olRecip.Resolve
              .Send
          End With
  
          On Error Resume Next
          iRow = iRow + 1
      
      Loop
      
      Set olApp = Nothing
  End Sub
  </code></pre>