title: Using Application.Intersect why do I get Type Mismatch
body: <p>Here is my code. I thought this should work; I'm saving the wb and trying to get the Excel Application object by using wb.Application. It actually works but XLApp.Intersect fails with "Type Mismatch" error.</p>
  
  <pre><code>Dim wb As Object
  
  Sub First()
      Dim XLApp As Object
      XLApp = CreateObject("Excel.Application")
      wb = myXL.XLApp.Workbooks.Add()
  End Sub
  
  Sub Second()
      Dim XLApp as object = wb.Application
      Dim rg as object = XLApp.Intersect(ws.UsedRange, ws.Columns("B"))
  End Sub
  </code></pre>
  
  <p>Is it possible to get Excel Application from the workbook and still use the Intersect method?</p>
  
  <p>I also tried saving the XLapp to a global variable and re-using it, but that didn't work either; same error.</p>
  
  <p>I am trying to avoid using an Excel Interop reference to maintain backward compatibility with old versions of Excel.</p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel._application.intersect%28v=office.11%29.aspx" rel="nofollow">MSDN Library _Application.Intersect Method</a> </p>
  
  <p>I noticed that my application object is of type: Microsoft.Office.Interop.Excel.ApplicationClass </p>