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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top