¤
¤ I want to generate an Excel file (.xls format) from some database data.
¤
¤ I don't want to use Excel.exe because of all the automation and security
¤ issues.
¤
¤ Does Microsoft document the .xls file format anywhere?
You can create an Excel Workbook file using Jet OLEDB and Jet SQL:
Dim ConnectionString As String
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Test Files\ExcelWB.xls;Extended Properties=Excel 8.0"
Dim ExcelConnection As New System.Data.OleDb.OleDbConnection(ConnectionString)
ExcelConnection.Open()
Dim SQLDDLCommand As String = "CREATE TABLE tblCustomers " & _
"(CustomerID INTEGER, " & _
"[Last Name] TEXT(50), " & _
"[First Name] TEXT(50), " & _
"Phone TEXT(10), " & _
"Email TEXT(50))"
Dim ExcelCommand As New System.Data.OleDb.OleDbCommand(SQLDDLCommand, ExcelConnection)
ExcelCommand.ExecuteNonQuery()
ExcelConnection.Close()
Paul
~~~~
Microsoft MVP (Visual Basic)