主题:调用EXecl数据到msflexgrid中显示
Private Sub Command1_Click()
Dim xlsconn As New ADODB.Connection
Dim xlscmd As New ADODB.Command
Dim rs As New ADODB.Recordset
xlsconn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\TEST\test.xls;Extended Properties=excel 8.0;Persist Security Info=False"
xlsconn.Open
'弹出提示对象变量或WITH未设置,RS的结果为noting,
Set rs = xlsconn.Execute("select * from [sheet1$]")
Set MSFlexGrid1.DataSource = rs
rs.Close
MSFlexGrid1.Refresh
End Sub
小弟愚昧,刚学不知道怎么回事,烦大哥们给我指出错误的地方,帮我改正过来。谢谢了
Dim xlsconn As New ADODB.Connection
Dim xlscmd As New ADODB.Command
Dim rs As New ADODB.Recordset
xlsconn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\TEST\test.xls;Extended Properties=excel 8.0;Persist Security Info=False"
xlsconn.Open
'弹出提示对象变量或WITH未设置,RS的结果为noting,
Set rs = xlsconn.Execute("select * from [sheet1$]")
Set MSFlexGrid1.DataSource = rs
rs.Close
MSFlexGrid1.Refresh
End Sub
小弟愚昧,刚学不知道怎么回事,烦大哥们给我指出错误的地方,帮我改正过来。谢谢了