Goodday,
I have a download button in my web page. When i click on the button, it should be able to download all the data in the datagrid to excel.
But i am getting this error:-
System.Runtime.InteropServices.COMException: Member not found.
I have included the following namespace in the web page but still error.......
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="Excel" %>
Here is my coding
=============
asp Code:
Dim rw As DataGridItem
Dim clcnt As Integer
Dim clval As String
Dim oExcel As Excel.Application
Dim oBook As Excel.Workbook
Dim oSheet As Excel.Worksheet
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add
oSheet = oBook.Worksheets(1)
dim rcnt as integer
rcnt=1
For Each rw In dgSummary.Items
For clcnt = 0 To rw.Cells.Count - 1
clval = rw.Cells(0).Text.ToString
oSheet.Cells(rcnt, clcnt).value = clval
Next
rcnt=rcnt +1
Next
oBook.SaveAs("c:\myfile.xls")
Anyone can help me?
Thank you very very much.