Decided to start a new thread as it is specific to Excel but I think it's the same macanisim as another thread called "Class not exists: NetOffice.OfficeApi.Document"
My issue is related to WorkbookConnection class
I got a valid WorkbookConnection objet using:
powerPivotConnection = book.Connections
.OfType<WorkbookConnection>()
.Where(n => n.Name == "PowerPivot Data" || n.Name == "ThisWorkbookDataModel")
.FirstOrDefault();
then I use this to reconnect:
powerPivotConnection.OLEDBConnection.Reconnect();
everything is fine until I try to get this property:
powerPivotConnection.OLEDBConnection.ADOConnection
It raises an Exception (stack here):
à NetOffice.Core.CreateObjectFromComProxy(IFactoryInfo factoryInfo, COMObject caller, Object comProxy, Type comProxyType, String className, String fullClassName)
à NetOffice.Core.CreateObjectFromComProxy(COMObject caller, Object comProxy)
à NetOffice.ExcelApi.OLEDBConnection.get_ADOConnection()
à Powerpivot_Refresh.ExcelUtilities.TryRefreshPowerPivot(Workbook book) dans c:\Users\pasielskyf\Documents\Dev\PSO_tools\Powerpivot_Refresh\ExcelUtilities.cs:ligne 143
à PSO_tools.Addin.Btn_importDiver_Click(IRibbonControl Ctrl) dans c:\Users\pasielskyf\Documents\Dev\PSO_tools\PSO_tools\Addin.cs:ligne 301
I managed this using reflection as discussed in "Class not exists: NetOffice.OfficeApi.Document" topic, but I'm sure there is better to do.
If you need additionnal information, let me know
Comments: ** Comment from web user: SebastianDotNet **
My issue is related to WorkbookConnection class
I got a valid WorkbookConnection objet using:
powerPivotConnection = book.Connections
.OfType<WorkbookConnection>()
.Where(n => n.Name == "PowerPivot Data" || n.Name == "ThisWorkbookDataModel")
.FirstOrDefault();
then I use this to reconnect:
powerPivotConnection.OLEDBConnection.Reconnect();
everything is fine until I try to get this property:
powerPivotConnection.OLEDBConnection.ADOConnection
It raises an Exception (stack here):
à NetOffice.Core.CreateObjectFromComProxy(IFactoryInfo factoryInfo, COMObject caller, Object comProxy, Type comProxyType, String className, String fullClassName)
à NetOffice.Core.CreateObjectFromComProxy(COMObject caller, Object comProxy)
à NetOffice.ExcelApi.OLEDBConnection.get_ADOConnection()
à Powerpivot_Refresh.ExcelUtilities.TryRefreshPowerPivot(Workbook book) dans c:\Users\pasielskyf\Documents\Dev\PSO_tools\Powerpivot_Refresh\ExcelUtilities.cs:ligne 143
à PSO_tools.Addin.Btn_importDiver_Click(IRibbonControl Ctrl) dans c:\Users\pasielskyf\Documents\Dev\PSO_tools\PSO_tools\Addin.cs:ligne 301
I managed this using reflection as discussed in "Class not exists: NetOffice.OfficeApi.Document" topic, but I'm sure there is better to do.
If you need additionnal information, let me know
Comments: ** Comment from web user: SebastianDotNet **
Please include/reference all MS Access Assemblies.
what do you awaiting in result of ADOConnection?
which type is that ???
(NetOffice 1.7.3 has a known issue with external assemblies here)
Sebastian