dim app as new Excel.Applicaton dim book as excel.workbook set book = app.workbooks.open dim sheet as excel.worksheet set sheet = book.worksheets(1) dim ss as string ss = sheet.cell(1,1)' ss 就是你要的。
方法1 dim n as long Dim oConn As New ADODB.Connection Dim oRS As New ADODB.Recordset oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\Book1.xls;" & _ "Extended Properties=""Excel 8.0;""" oRS.Open "Select * from [Sheet1$]", oConn, adOpenStatic n = 1 do until oRS.EOF msgbox "第" & n & " 条记录,第一列:" & oRS.fields(1) & _ ";第二列:" & oRS.fields(2) n = n + 1 oRS.Movenext Loop oRS.Close oConn.Close
dim book as excel.workbook
set book = app.workbooks.open
dim sheet as excel.worksheet
set sheet = book.worksheets(1)
dim ss as string ss = sheet.cell(1,1)' ss 就是你要的。
dim n as long
Dim oConn As New ADODB.Connection
Dim oRS As New ADODB.Recordset
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Book1.xls;" & _
"Extended Properties=""Excel 8.0;"""
oRS.Open "Select * from [Sheet1$]", oConn, adOpenStatic
n = 1
do until oRS.EOF
msgbox "第" & n & " 条记录,第一列:" & oRS.fields(1) & _
";第二列:" & oRS.fields(2)
n = n + 1
oRS.Movenext
Loop
oRS.Close
oConn.Close