goilaswati
Programmer
i have this problem that i want to export my data of
datagrid to excel worksheet and i use the following code
i just write this code to load event of the form
firstly consider the code
Private Sub Form_Load()
Dim excel_app As New Excel.Application
Dim excel_sheet As New Excel.Worksheet
Dim row As Long
Dim rs As New ADODB.Recordset
Dim statement As String
Dim i As Integer
Set excel_app = CreateObject("Excel.Application"
excel_app.Visible = True
rs.CursorLocation = adUseClient
rs.Open "select * from weeklyitem", db, adOpenDynamic, adLockOptimistic
' MsgBox rs.Fields(1)
excel_sheet.Cells(1, 1) = rs.Fields(1).Value
' For i = 1 To rs.Fields.Count - 1
' excel_sheet.Cells(1, i) = rs.Fields(i).Name
' Next i
' row = 2
' Do While Not rs.EOF
' For i = 1 To rs.Fields.Count - 1
' excel_sheet.Cells(row, i) = rs.Fields(i).Value
' Next i
'
' row = row + 1
' rs.MoveNext
' Loop
rs.Close
End Sub
now sir i have see a error msg
that "class does not support automation or does not
support expected interface"
plz tell me what i do
datagrid to excel worksheet and i use the following code
i just write this code to load event of the form
firstly consider the code
Private Sub Form_Load()
Dim excel_app As New Excel.Application
Dim excel_sheet As New Excel.Worksheet
Dim row As Long
Dim rs As New ADODB.Recordset
Dim statement As String
Dim i As Integer
Set excel_app = CreateObject("Excel.Application"
excel_app.Visible = True
rs.CursorLocation = adUseClient
rs.Open "select * from weeklyitem", db, adOpenDynamic, adLockOptimistic
' MsgBox rs.Fields(1)
excel_sheet.Cells(1, 1) = rs.Fields(1).Value
' For i = 1 To rs.Fields.Count - 1
' excel_sheet.Cells(1, i) = rs.Fields(i).Name
' Next i
' row = 2
' Do While Not rs.EOF
' For i = 1 To rs.Fields.Count - 1
' excel_sheet.Cells(row, i) = rs.Fields(i).Value
' Next i
'
' row = row + 1
' rs.MoveNext
' Loop
rs.Close
End Sub
now sir i have see a error msg
that "class does not support automation or does not
support expected interface"
plz tell me what i do