麻烦老师朋友们给个用VB操作EXCEL的例子学习也就是在VB环境中用SQL的形式操作EXCEL工作表!
解决方案 »
- 求救:怎样枚举窗体所有子控件 ???
- 为什么总是无法在网页上成功发布activex控件?
- 急急急!50分求“vbscript”创建“拨号连接”的代码
- commondialog怎样指定open时候对话框的位置.
- 用real控件打包出现问题!用过的帮我看看啊!
- 如何同步调用外部程序?
- 关于datareport?
- 怎样读取F1功能键出自己的帮助文件?
- vb备份时提示[Microsoft] 无法打开备份设备。出现操作系统错误 3(系统找不到指定的路径)怎么解决
- VBA中出现错误script engine for the specified language can not be created
- SQL 批量替换问题
- 如何在MSHFlexGrid 某一列放Combobox
Dim adoRecordset As New ADODB.Recordset
adoConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0Persist Security Info=False;" & "Data Source=C:\ABC.XLS;Extended Properties='Excel 8.0;HDR=Yes'"
adoRecordset.Open "select * from [sheet1$]", adoConnection,adOpenKeyset, adLockOptimistic
Set MSHFlexGrid1.DataSource = adoRecordset
Private Sub Command1_Click()
Dim adoConnection As New ADODB.Connection
Dim adoRecordset As New ADODB.Recordset
adoConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;" & "Data Source=C:\1.XLS;Extended Properties='Excel 8.0;HDR=Yes'"
adoRecordset.Open "select * from [sheet1$]", adoConnection, adOpenKeyset, adLockOptimistic
Set MSHFlexGrid1.DataSource = adoRecordset
End Sub
1.引用 Microsoft ActiveX Data Objects 2.* Library 2.1以上的
2.excel版本是2003以下的,如果是2007版的,要转换为低版本的