System.Exception: Cannot create ActiveX component. at Microsoft.Vi

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to output a dataset to excel from a text file but did not work.
I alreay add the microsoft active component 2.7 and 2.8 and microsoft excel
11 component library but no luck. Please show me the light!

Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.Common
Imports System.IO
Imports Microsoft.Office.Core
Imports Microsoft.Office.Interop.Excel

Try

'Create a new instance of Excel.
Dim oExcel As Object
oExcel = CreateObject("Excel.Application")

'Open the text file and save it in the Excel workbook format.
oExcel.Workbooks.OpenText(sSampleFolder & "help.txt", _
, , , -4142, , True) 'xlTextQualifierNone=-4142

oExcel.ActiveWorkbook.SaveAs(sSampleFolder & "help.xls", _
-4143) 'xlWorkbookNormal = -4143

'Quit Excel.
oExcel.Quit()
oExcel = Nothing
GC.Collect()

Catch ex As Exception
Response.Write(ex.ToString)
End Try
 
Back
Top