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