title: How to import data into MS excel 2010 from SQL developer (Oracle) using VBA macro
body: <p>I want to import data into MS excel 2010 from <code>SQL</code> developer (<code>Oracle</code>) using <code>VBA</code> macro</p>
  
  <p>I am using below code but not able to connect to <code>SQL</code> devevloper. Getting error like Provider not found or not installed.</p>
  
  <p>Kindly help.</p>
  
  <pre><code>Sub ImportData()
  
  Sheets("sheet1").Select
  
  With ActiveSheet.ListObjects.Add(SourceType:=0, Source:= _
      "OLEDB;Provider=MSDAORA.1;User ID=MY_USER;password= MY_PW;Data Source=sourceName", Destination _
      :=Range("$A$1")).QueryTable
      .CommandType = xlCmdSql
      .CommandText = "Select Main.[ID],Main.[Count1] From Main Where Main.[Count1] &gt; 25"
      .RowNumbers = False
      .FillAdjacentFormulas = False
      .PreserveFormatting = True
      .RefreshOnFileOpen = False
      .BackgroundQuery = True
      .RefreshStyle = xlInsertDeleteCells
      .SavePassword = False
      .SaveData = True
      .AdjustColumnWidth = True
      .RefreshPeriod = 0
      .PreserveColumnInfo = True
      .Refresh BackgroundQuery:=False
  End With
  
  End Sub
  </code></pre>