bovender / XLToolbox

Daniel's XL Toolbox is an open-source add-in for Excel(R) that assists with scientific and technical data analysis and visualization.
https://www.xltoolbox.net
Apache License 2.0
55 stars 10 forks source link

Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Core.IRibbonUI'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000C03A7-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)). (78021820) #179

Open bovender opened 8 years ago

bovender commented 8 years ago

This issue was submitted by the add-in's exception handler.

Exception:

System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Core.IRibbonUI'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000C03A7-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).
   at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
   at Microsoft.Office.Core.IRibbonUI.InvalidateControl(String ControlID)
   at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)
   at Bovender.Mvvm.ViewModels.ViewModelBase.OnPropertyChanged(String propertyName)
   at Bovender.Versioning.UpdaterViewModel.set_DestinationFolder(String value)
   at Bovender.Versioning.UpdaterViewModel.<DoChooseDestinationFolder>b__f(FileNameMessageContent returnContent)
   at Bovender.Mvvm.Messaging.Message`1.<>c__DisplayClass2.<Send>b__0()
   at Bovender.Mvvm.Actions.FileFolderActionBase.Invoke(Object parameter)
   at System.Windows.Interactivity.TriggerBase.InvokeActions(Object parameter)
   at Bovender.Mvvm.Messaging.Message`1.Send(T messageContent, Action`1 respond)
   at Bovender.Versioning.UpdaterViewModel.DoChooseDestinationFolder()
   at Bovender.Versioning.UpdaterViewModel.<get_ChooseDestinationFolderCommand>b__4(Object param)
   at Bovender.Mvvm.DelegatingCommand.Execute(Object parameter)

Message: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Core.IRibbonUI'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000C03A7-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).

Environment

Parameter Value
Version 7.0.0
OS Microsoft Windows NT 6.1.7601 Service Pack 1, 64-bit
Excel 2013 SP1 (15.0.4849), 64-bit
CLR 4.0.30319.34209, 64-bit
VSTO runtime
ClickOnce False
Bovender 0.11.0.0
FreeImage 3.16.0
webartoli commented 6 years ago

We had this issue in case of Office Downgrade, or install of different compontents of office at different versions.

In my experience this can be happened in Excel 2010 (x64 or x86) when higher version of any office components are installed (Skype4Business in example).

We have solved the issue removing this registry key (with all subkeys): HKEY_CLASSES_ROOT\TypeLib\{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}\2.8

Leave unchaged 2.5 and 2.6

From admin command prompt reg delete HKEY_CLASSES_ROOT\TypeLib\{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}\2.8

Source: https://superuser.com/a/1332244

webartoli commented 6 years ago

Maybe this solution can be helpful for #141