With VB2008 I am able to create a new Excel sheet as the following:
Dim conn2 As New OleDbConnection()
conn2.ConnectionString = m\_sExcelConnection
conn2.Open()
Dim cmd As New OleDbCommand()
cmd.Connection = conn2
cmd.CommandText = "CREATE TABLE Detail (Invoice\_No char(255),CheckIn char(255),CheckOut char(255),"
cmd.CommandText += "RNum integer,Guest\_Name char(255),Base\_Room\_Charge Decimal,Service\_Charge Decimal,"
cmd.CommandText += "HEBERGEMENT Decimal,TPS Decimal,TVQ Decimal,Total\_Taxes Decimal,Total\_Charges Decimal,"
cmd.CommandText += "Total\_Deposit Decimal)"
Try
cmd.ExecuteNonQuery()
conn2.Close()
Catch ex As Exception
conn2.Close()
End Try
- However, after I INSERT data into their columns then try to sorting each column, the Header also being sorting - But if I hight-light the Header row and right-click on it then selecting Cell Format --> Protection --> Mask ... then I can sort every column without touching the Headers *) Since the user probably doesn't know how to do like me, I would like to program it automatically with VB ... any one can help? Thanks in-advanced