Creating and Deleting worksheets in Excel usign Visual Studio
Posted on 2010-08-30
I want to export data to an existing excel spreadsheet and into a specific worksheet. Each time I will need to delete and then re-create the worksheet. But I do not know what the command is for either. I tried the following to create it and it processed thru without error but i do not see it when I open the spreadsheet (it did not previously exist). I am using Visual Studio 2008.
Dim SQL1 = "Create Table [TestData2]"
Dim ExcelConnection As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & “c:\test.xls” & ";" & _
"Extended Properties=""Excel 8.0;HDR=YES""")
Dim ExcelCommand As New System.Data.OleDb.OleDbCommand(SQL1, ExcelConnection)