[求助] 应用程序或对象定义错误,怎么错了阿??
Private Sub データ取得_Click() Dim OraSession As Object Dim OraDatabase As Object Dim rs As Object Dim rownu As Long Dim colnum As Integer Dim tig As String Dim tigtemp As String Dim haveflag As Integer Dim rcd As Integer On Error GoTo ErrorTrap Set OraSession = CreateObject("OracleInProcServer.XOraSession") Set OraDatabase = OraSession.OpenDatabase("dir", "dir/dir", 0&) tigtemp = ActiveSheet.Cells(3, 7).Text haveflag = InStr(1, tigtemp, "where", 1) tig = Left(tigtemp, haveflag + 5) & " rownum < 100 and " & Right(tigtemp, Len(tigtemp) - haveflag - 4) Set rs = OraDatabase.CreateDynaset(tig, 0&) For colnum = 0 To rs.Fields.Count - 1 ActiveSheet.Cells(6, colnum + 5) = rs(colnum).Name Next rownu = 0 Do Until rs.EOF For colnum = 0 To rs.Fields.Count - 1 'rs.Fields.Count = 32的时候,出错了,不知道为什么` ActiveSheet.Cells(rownu + 7, colnum + 5) = rs(colnum).Value '出错的时候rownu =0 colnum =15 Next rs.MoveNext rownu = rownu + 1 Loop rs.Close Set rs = Nothing Set OraDatabase = Nothing Set OraSession = Nothing Exit SubErrorTrap: rcd = MsgBox("内容:" & Err.Description & Chr(10) & Chr(10) & " GO ON OR NOT?", 4, "ERR") If rcd = 6 Then Exit Sub Else Resume Next End If End Sub