title: VBA Method 'Union' of object '_Global' failed
body: <p>I'm trying to write a macro that loops through all the Workbooks in a folder, and for each one sends an email with a range of rows that meet criteria. When I run the macro, it does this for the first file but stops at the second giving the error "Method 'Union' of object '_Global' failed", pointing to the line "Set rng2 = Union(rng2, row)". Below is the relevant code:</p>
  
  <pre><code>Sub LoopThroughFiles()
  
  Dim File As String
  
  File = Dir("FilePath\")
  
  While (File &lt;&gt; "")
  
      Set WorkBk = Workbooks.Open("FilePath\" &amp; File)
  
      Dim rng As Range
      Dim row As Range
      Dim rng2 As Range
      Dim strbody As String
  
      Dim OutApp As Object
      Dim OutMail As Object
  
      Set rng = Range("B52:I200")
  
      For Each row In rng.Rows
          If row.Columns(7) &gt;= Date Then
              If Not rng2 Is Nothing Then
                  'Below is the line that gets the error
                  Set rng2 = Union(rng2, row)
              Else
                  Set rng2 = row
              End If
          End If
      Next
  
      'Email code removed
  
      WorkBk.Close savechanges:=True
  
      File = Dir()
  
  Wend
  
  End Sub
  </code></pre>
  
  <p>Any help would be greatly appreciated!</p>