'create a new sheet. Define some columns and data types objCmd.CommandText = "CREATE TABLE NewSheet (Col1 TEXT, Col2 NUMBER, Col3 DATE)" 'insert some data. You can now refer to the column names objCmd.CommandText = "INSERT INTO [NewSheet$] (Col1, Col2) VALUES ('Some Text', 123)"HTH
>'Establish a connection to the data source.
> Dim sConnectionString As String
> sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
> "Data Source=" & sSampleFolder & _
> "Book7.xls;Extended Properties=Excel 8.0;"
> Dim objConn As New System.Data.OleDb.OleDbConnection _
> (sConnectionString)
> objConn.Open()
>
> 'Add a record to the table.
> Dim objCmd As New System.Data.OleDb.OleDbCommand()
> objCmd.Connection = objConn
>
> objCmd.CommandText = "Insert into [Sheet1$] (A)" & _
> " values ('Bill')"
>
> ' In place of A, I have tried A1 and ID after renaming the cell.
> objCmd.ExecuteNonQuery()
>
> 'Close the connection.
> objConn.Close()
><\pre>Daniel