用vb打开的一个excel文件 如何得到它的行数及列数
解决方案 »
- 动态创建标签数组
- 如何禁用客户删除电脑里任何文件?
- 10.0版的Excel Object Libray SaveAs 在office97上出错。怎么办?
- sql server or access数据导入导出的api是?
- 一直困挠的问题,不是很清楚******VB中的锁和SQL数据库锁(在线等待,参于者给分)
- ADO真的能连接Internet环境下的SQL SERVER 数据库吗?
- 关于水晶报表的formula全局变量的问题!
- VB打包后的问题!!!我对VB这种行为已经忍无可忍了!!!!!!!!!!!!!!!
- 如何设置TextBox,CombBox,获取焦点的快截键
- 请问:VB5按钮怎样加快截键?
- Dim db As Database出错?在线结帖!!
- 请问怎样清除realplayer的记录
strFileName = dirname & filename & ".xls"
adoConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & strFileName & ";Extended Properties='Excel 8.0;HDR=Yes'"
adoRecordset.Open "select * from [tow.sheet$] where 塔号 is not null", adoConnection, adOpenKeyset, adLockOptimistic有多少记录多少字段,循环就可以知道了
Dim cnSource As New ADODB.Connection
Dim rsSource As New ADODB.Recordset
cnSourceDb.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strSourceFile & ";Extended Properties=Excel 8.0;Persist Security Info=true"
rsSource.CursorLocation = adUseClient
rsSource.Open "select * from [" & strSourceTable & "]", cnSource, adOpenKeyset, adLockOptimistic
GetExcelRowCount= rsSource.RecordCount
cnSource.close
rsSource.close
set cnSource=nothing
set rsSource=nothing
End Function调用:GetExcelRowCount( "d:\new.xls","Sheet1$")
GetExcelColCount=rsSource.Fields.Count