I want to manipulate a Excel file with Visual Basic , using Microsoft Excel 16.0 Object Library for this I have:
Imports Excel = Microsoft.Office.Interop.Excel
Public Class Form1
Public Aplicacion As New Excel.Application
Public Libro As New Excel.Workbook
Public Hoja As New Excel.Worksheet
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Libro = Aplicacion.Workbooks.Open("test.xlsx")
Hoja = Aplicacion.Worksheets("Hoja1")
End Sub
End Class
But the answer is an exception:
Error creating the form. See Exception.InnerException for more details. Error: The COM class generator for the component with CLSID {00020819-0000-0000-C000-000000000046} could not be recovered due to the following error: 80040154 Class not registered (HRESULT exception: 0x80040154 (REGDB_E_CLASSNOTREG)).
I have Office 2016 installed
How can I fix the error?
In Response to Cristina
It's Windows Forms project. As for assigning permissions, I do not understand what you mean, and configure user in DCOM.
Tell me how I can do what you mention.