Private Sub Form_Load() Dim RS As ADODB.Recordset Set RS = GetExcelRs(App.Path & "\book1.xls") MsgBox RS.RecordCount MsgBox RS(0) RS(0) = Timer RS.Update RS.Close End Sub '┏〓〓〓〓〓〓〓〓〓 GetExcelRs,start 〓〓〓〓〓〓〓〓〓┓ '[简介]: 'VB读取EXCEL工作薄某个表中数据 Function GetExcelRs(ByVal sFile As String,Optional ExcelSheetName As String = "sheet1",Optional ErrInfo As String) As ADODB.Recordset '[mycode_id:2025],edittime:2011-9-7 下午 02:15:41 On Error GoTo Err Dim RS As ADODB.Recordset Set RS = New ADODB.Recordset Dim ConnStr As String ConnStr = "DRIVER=Microsoft Excel Driver (*.xls);" & "DBQ=" & sFile & ";ReadOnly=False" RS.Open "SELECT * FROM [" & ExcelSheetName & "$]",ConnStr,1,3 Set GetExcelRs = RS Set RS = Nothing Exit Function Err: ErrInfo = Err.Description MsgBox ErrInfo End Function '┗〓〓〓〓〓〓〓〓〓 GetExcelRs,end 〓〓〓〓〓〓〓〓〓┛