title: select multiple column from excel in VBA
body: <p>How can I select multiple column in Excel file using Vba. because I have excel file contains 580 columns.</p>
  
  <p>I try using Query below, but its only can select 255 columns.</p>
  
  <pre><code>Dim ExcelConnection As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" &amp; TxtPath.Text &amp; "; Extended Properties=""Excel 12.0 Xml; HDR=Yes""")
          ExcelConnection.Open()
  
          Dim expr As String = "select * FROM [Sheet1$]"
          Dim objCmdSelect As OleDbCommand = New OleDbCommand(expr, ExcelConnection)
          Dim objDR As OleDbDataReader
  
          Dim SQLconn As New SqlConnection()
          Dim ConnString As String = "data source=" &amp; DBServer1 &amp; "; initial catalog=" &amp; DBDataBase1 &amp; "; persist security info=true; user id=" &amp; DBUSer1 &amp; "; password=" &amp; DBPass1
          SQLconn.ConnectionString = ConnString
          SQLconn.Open()
  
          Using bulkCopy As SqlBulkCopy = New SqlBulkCopy(SQLconn)
              bulkCopy.DestinationTableName = "TMP_UPLOAD_ISP"
  
              Try
                  objDR = objCmdSelect.ExecuteReader
                  bulkCopy.WriteToServer(objDR)
                  objDR.Close()
                  SQLconn.Close()
  
              Catch ex As Exception
                  MsgBox(ex.ToString)
              End Try
  </code></pre>
  
  <p>I try by using select column header (220 Columns to select) ,its getting error until I reduce down to 100 columns.</p>
  
  <pre><code>Dim ExcelConnection As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" &amp; TxtPath.Text &amp; "; Extended Properties=""Excel 12.0 Xml; HDR=Yes""")
          ExcelConnection.Open()
  
          Dim expr As String = "select Plan_Year,Colom4,Colom6,Colom7,Colom21,Colom22,Colom24,Colom25,Colom27,Colom28,Colom33,Colom34,Colom38,Colom39,Colom41,Colom42,Colom47,Colom48,Colom49,Colom50,Colom51,Colom52,Colom66,Colom67,Colom69,Colom70,Colom72,Colom73,Colom78,Colom79,Colom83,Colom84,Colom86,Colom87,Colom92,Colom93,Colom94,Colom95,Colom96,Colom97,Colom111,Colom112,Colom114,Colom115,Colom117,Colom118,Colom123,Colom124,Colom128,Colom129,Colom131,Colom132,Colom137,Colom138,Colom139,Colom140,Colom141,Colom142,Colom156,Colom157,Colom159,Colom160,Colom162,Colom163,Colom168,Colom169,Colom173,Colom174,Colom176,Colom177,Colom182,Colom183,Colom184,Colom185,Colom186,Colom187,Colom201,Colom202,Colom204,Colom205,Colom207,Colom208,Colom213,Colom214,Colom218,Colom219,Colom221,Colom222,Colom227,Colom228,Colom229,Colom230,Colom231,Colom232,Colom246,Colom247,Colom249,Colom250,Colom252,Colom253,Colom258,Colom259,Colom263,Colom264,Colom266,Colom267,Colom272,Colom273,Colom274,Colom275,Colom276,Colom277,Colom303,Colom304,Colom306,Colom307,Colom309,Colom310,Colom315,Colom316,Colom320,Colom321,Colom323,Colom324,Colom329,Colom330,Colom331,Colom332,Colom333,Colom334,Colom348,Colom349,Colom351,Colom352,Colom354,Colom355,Colom360,Colom361,Colom365,Colom366,Colom368,Colom369,Colom374,Colom375,Colom376,Colom377,Colom378,Colom379,Colom393,Colom394,Colom396,Colom397,Colom399,Colom400,Colom406,Colom407,Colom410,Colom411,Colom413,Colom414,Colom419,Colom420,Colom421,Colom422,Colom423,Colom424,Colom438,Colom439,Colom441,Colom442,Colom444,Colom445,Colom450,Colom451,Colom455,Colom456,Colom458,Colom459,Colom464,Colom465,Colom466,Colom467,Colom468,Colom469,Colom483,Colom484,Colom486,Colom487,Colom489,Colom490,Colom495,Colom496,Colom500,Colom501,Colom503,Colom504,Colom509,Colom510,Colom511,Colom512,Colom513,Colom514,Colom528,Colom529,Colom531,Colom532,Colom534,Colom535,Colom540,Colom541,Colom545,Colom546,Colom548,Colom549,Colom554,Colom555,Colom556,Colom557,Colom558,Colom559 FROM [Sheet1$]"
          Dim objCmdSelect As OleDbCommand = New OleDbCommand(expr, ExcelConnection)
          Dim objDR As OleDbDataReader
  
          Dim SQLconn As New SqlConnection()
          Dim ConnString As String = "data source=" &amp; DBServer1 &amp; "; initial catalog=" &amp; DBDataBase1 &amp; "; persist security info=true; user id=" &amp; DBUSer1 &amp; "; password=" &amp; DBPass1
          SQLconn.ConnectionString = ConnString
          SQLconn.Open()
  
          Using bulkCopy As SqlBulkCopy = New SqlBulkCopy(SQLconn)
              bulkCopy.DestinationTableName = "TMP_UPLOAD_ISP"
  
              Try
                  objDR = objCmdSelect.ExecuteReader
                  bulkCopy.WriteToServer(objDR)
                  objDR.Close()
                  SQLconn.Close()
  
              Catch ex As Exception
                  MsgBox(ex.ToString)
              End Try
  </code></pre>
  
  <p>How can I Select column that I want to select (220 columns intermittently).</p>