VB多窗口调用一个EXCEL表格的问题

来源:百度知道 编辑:UC知道 时间:2024/06/08 08:02:32
在VB工程里面如何用多个窗体来同时调用一个EXCEL表格?
本人只会用VB调用EXCEL表格。其他的不会,希望附加调用程序,谢谢!

不用打开吧,我只是想在多个窗口中调用同一个表格。
程序里面该如何定义,如何调用?

在工程的应用中加Microsoft ActiveX Data Object 2.5
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sheet1 As String
Function getdata()
If rs.Fields.Item(0).Value <> "" Then Text1(0).Text = rs.Fields.Item(0).Value
If rs.Fields.Item(1).Value <> "" Then Text1(1).Text = rs.Fields.Item(1).Value
If rs.Fields.Item(2).Value <> "" Then Text1(2).Text = rs.Fields.Item(2).Value
If rs.Fields.Item(3).Value <> "" Then Text1(3).Text = rs.Fields.Item(3).Value
If rs.Fields.Item(4).Value <> "" Then Text1(4).Text = rs.Fields.Item(4).Value
If rs.Fields.Item(5).Value <> "" Then Text1(5).Text = rs.Fields.Item(5).Value
If rs.Fields.Item(6).Value <> "" Then Text1(6).Text = rs.Fields.Item(6).Value
If rs.Fields.Item(7).Value <> "" Then Text1(7).Text = rs.Fields.Item(7).Value
If rs.Fields.Item(8