Access error with Microsoft.Office.Interop

0

Good morning, I have an application in which I generate an Excel from some html files, everything works correctly locally but when I publish it on the server it works sometimes if and sometimes not.

I am not able to come up with the solution, I have configured the server with the corresponding permissions as I have seen in some tutorials giving access to the user Network Service.

I put the code in case I do something wrong and the error message.

  

The COM class generator for the component with CLSID {00024500-0000-0000-C000-000000000046} could not be recovered due to the following error: 8000401a The server process could not be started because the configured identity is not correct Check the username and password. (Exception from HRESULT: 0x8000401A)

Dim xls As Excel.Application
Dim workbook As Excel.Workbook
Dim workbook2 As Excel.Workbook 

xls = New Excel.Application
workbook = xls.Workbooks.Open(miruta & "\mifichero.html")
workbook2 = xls.Workbooks.Open(miruta& "\fichero2.html")

workbook.Sheets(1).Columns("B:Z").ColumnWidth = 15
workbook.Sheets(1).Columns("A:A").ColumnWidth = 30

Dim HOJA_1 As Microsoft.Office.Interop.Excel.Sheets = workbook2.Sheets 

HOJA_1.Copy(Type.Missing, workbook.Sheets(workbook.Sheets.Count))
workbook.Sheets(workbook.Sheets.Count).Name = "RANKING"

workbook.Sheets(workbook.Sheets.Count).Columns("A:C").ColumnWidth = 50

Dim nombre = "Minombre"
workbook.SaveAs(miruta & "\" & miUsuario.Id_Usuario & "_" & nombre, Excel.XlFileFormat.xlOpenXMLWorkbook,)

excelApp.DisplayAlerts = False
excelApp.ActiveWorkbook.Close(0)
excelApp.Quit()

Runtime.InteropServices.Marshal.ReleaseComObject(excelApp)
excelApp = Nothing
    
asked by user2556511 12.09.2017 в 11:13
source

0 answers