求VB中与EXCEL表连接,从EXCEL表中读数据解决办法

求VB中与EXCEL表连接,从EXCEL表中读数据
求VB中与EXCEL表连接,从EXCEL表中读数据,数据在EXCEL中是矩阵的形式,在VB中是二维数组。高手们帮帮忙吧

------解决方案--------------------
VBScript code

Option Explicit
Dim ex As Excel.Application
Dim wb As Excel.Workbook
Dim sh As Excel.Worksheet

Private Sub Form_Load()
On Error GoTo err1
Set ex = New Excel.Application
Set wb = ex.Workbooks.Open("C:\Documents and Settings\yong.ZZY\桌面\book1.xls")
Set sh = wb.Sheets(1)
Debug.Print sh.Name
Dim arr(1, 1)
Dim i As Integer, j As Integer
For i = 1 To 2
    For j = 1 To 2
        arr(i - 1, j - 1) = sh.Cells(i, j).Value
        Debug.Print arr(i - 1, j - 1)
    Next j
Next i

Exit Sub
err1:

Set sh = Nothing
Set wb = Nothing
Set ex = Nothing
Debug.Print Err.Description
End Sub

Private Sub Form_Unload(Cancel As Integer)

Set sh = Nothing
Set wb = Nothing
Set ex = Nothing

End Sub

------解决方案--------------------
忘了关闭了
wb.Close
ex.Quit
------解决方案--------------------
VB code

    Dim strFileName As String
    strFileName = GetExcelFileName("客户资料表", dlg)
    
    Dim objApp As New Excel.Application
    Dim exBook As Excel.Workbook
    Dim exSheet As Excel.Worksheet
    
    Set exBook = objApp.Workbooks.Open(strFileName)
    Set exSheet = exBook.Worksheets(1)
    //存放在varCustomerList中
    Dim varCustomerList As Variant
    
    varCustomerList = exSheet.UsedRange.Value

------解决方案--------------------
http://blog.****.net/vbman2003/archive/2007/10/25/1843645.aspx