Created several Vb.net(studio 2015) front end with MSSQL back end for data management. They all use office to export reports. We currently use Office 2010 and have no problems (Windows 7).
Some of the PCs have started to get Office 2016, and this is where suddenly I have ran into issues.
A Snippet a code here just to show.
Imports Excel = Microsoft.Office.Interop.Excel
Dim oExcel As Microsoft.Office.Interop.Excel.Application
oExcel = CreateObject("Excel.Application")
Dim wBook As Microsoft.Office.Interop.Excel.Workbook
Dim wSheet As Microsoft.Office.Interop.Excel.Worksheet
wBook = oExcel.Workbooks.Add()
wSheet = wBook.ActiveSheet()
With oExcel
.SheetsInNewWorkbook = 1
.Worksheets(1).Select()
Dim i As Integer = 2
.Cells(i, 1).value = "SUPERVISOR NAME"
.Cells(i, 2).value = "TOTAL"
For Col = 0 To Workflow_Set.Tables("Workflow").Rows.Count - 1
.Cells(i, Col + 3).value = RNF(Workflow_Set, "Workflow", Col, "Description")
.Cells(i, Col + 3).EntireColumn.AutoFit()
Next
.Visible = True
So I tried to install Office 2016 on my machine. Based off that code I get the error. I completely uninstalled 2010. I swapped all the references in my project from Office 14.0 to 16.0. It compiles just fine. But when I go to actually run the calls I get hit with the same issues as before.
"An unhandled exception of type 'System.Exception' occurred in Microsoft.VisualBasic.dll Additional information: Cannot create ActiveX component." On the line " oExcel = CreateObject("Excel.Application")"
Ok, so I try to change that to simple "oExcel= New excel.Application" Now that Gives a COM error. An unhandled exception of type "'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll Additional information: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."
I saw in another thread about using that to search for legacy outdated info, but that regkey ID doesn't SEEM to lead to anything. I have been trying isntalled different packages. Looking trhough Registry stuff for old office 2010 with no luck. I don't know what to do get this issues resolved at this point.