Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/07/2008, 16:51
icam
 
Fecha de Ingreso: abril-2008
Mensajes: 14
Antigüedad: 16 años, 1 mes
Puntos: 0
exportar datos a excel

Hola, necesito exportar unos datos a excel en vb.net. Cree una aplicacion: windows application e hice un ejemplo sencillo ke me funciono:

Private Function excel()
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Const sSampleFolder = "C:\ExcelData\"

'Start a new workbook in Excel.
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add

'Add data to cells of the first worksheet in the new workbook.
oSheet = oBook.Worksheets(1)
oSheet.Range("A1").Value = "Prueba"
oSheet.Range("B1").Value = "Segundo"
oSheet.Range("A1:B1").Font.Bold = True
oSheet.Range("A2").Value = "xxxxx"
oSheet.Range("B2").Value = YYYY"

'Save the workbook and quit Excel.
oBook.SaveAs(sSampleFolder & "Book1.xls")
oSheet = Nothing
oBook = Nothing
oExcel.Quit()
oExcel = Nothing
GC.Collect()
End Function

Esta me funciono bien, kise hacer la misma funcion en una aplicacion Asp.net web application t me marco este error:

No se puede crear el componente ActiveX.



Línea 184:
Línea 185: 'Start a new workbook in Excel.
Línea 186: oExcel = CreateObject("Excel.Application")


ke estoy haciendo mal o ke me falta?