我用adodb.connection类型变量cn打开一个excel2000的文件
cn.open "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;fil=excel 8.0;Dbq=" & FileName & ";DefaultDir=" & FileDirectoryDim adoxCatalogX As New ADOX.Catalog
Set adoxCatalogX.ActiveConnection = adoConnectionX
For i = 0 To adoxCatalogX.Tables.count - 1
If adoxCatalogX.Tables.Item(i).Type = "TABLE" Then '读取数据库结构,列出表名
tableList.AddItem (adoxCatalogX.Tables.Item(i).Name)
End If
Next i一个很奇怪的现象,我必须在源excel文件中定义命名区域,否则adoxCatalogX.Tables中就是空的,我想问一下,是否excel中的表结构就是命名区域
cn.open "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;fil=excel 8.0;Dbq=" & FileName & ";DefaultDir=" & FileDirectoryDim adoxCatalogX As New ADOX.Catalog
Set adoxCatalogX.ActiveConnection = adoConnectionX
For i = 0 To adoxCatalogX.Tables.count - 1
If adoxCatalogX.Tables.Item(i).Type = "TABLE" Then '读取数据库结构,列出表名
tableList.AddItem (adoxCatalogX.Tables.Item(i).Name)
End If
Next i一个很奇怪的现象,我必须在源excel文件中定义命名区域,否则adoxCatalogX.Tables中就是空的,我想问一下,是否excel中的表结构就是命名区域
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货