Hi
Here is some code snippet for your reference.
Dim cat As Object
Dim tbl As Object
Dim col As Object
Set cat = CreateObject("ADOX.Catalog")
cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & "E:\test\excel\test2.xls;Extended Properties=Excel 8.0"
Set tbl = CreateObject("ADOX.Table")
tbl.Name = "TestTable"
Set col = CreateObject("ADOX.Column")
With col
.Name = "Col1"
.Type = adDouble
End With
tbl.Columns.Append col
Set col = Nothing
Set col = CreateObject("ADOX.Column")
With col
.Name = "Col2"
.Type = adVarWChar
End With
tbl.Columns.Append col
cat.Tables.Append tbl
Best regards,
Perter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.