Hi,
Add ADO Reference to your Project,
and use this connection string :
-
Dim Con as New ADODB.Connection
-
Dim RST As New ADODB.Recordset
-
Dim sSQL As String
-
With Con
-
.Provider = "Microsoft.Jet.OLEDB.4.0"
-
.ConnectionString = "Data Source=C:\MyExcelWB.xls;" & _
-
"Extended Properties=Excel 8.0;"
-
.Open
-
End With
-
sSQL = "SELECT * FROM [Sheet1$]"
-
RST.Open sSQL,Con,1,3
-
-
Each Worksheet Acts as a Table,
Usually, First Row of the Sheet Is Field Names..
If, not, then Connection string need to be changed to :
-
"Extended Properties=" " Excel 8.0; HDR=No;" " "
-
REgards
Veena