Ho creato un componente aggiuntivo per Microsoft Office Word. Non esiste un problema nell'utilizzo del componente aggiuntivo quando Word viene eseguito come amministratore, ma quando non viene eseguito come amministratore, esistono due eccezioni comuni che accedono agli elementi della barra multifunzione.Errore durante l'accesso ai componenti COM
La prima eccezione:
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: could not be found. (Exception from HRESULT: 0x80030002 (STG_E_FILENOTFOUND)).
at Microsoft.Office.Core.IRibbonUI.InvalidateControl(String ControlID)
Questo errore si verifica quando il controllo viene invalidata dal codice seguente:
ribbon.InvalidateControl("control-id");
E la seconda eccezione:
Unable to cast COM object of type 'Microsoft.Office.Interop.Word.ApplicationClass' to interface type 'Microsoft.Office.Interop.Word._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00020970-0000-0000-C000-000000000046}' failed due to the following error: could not be found. (Exception from HRESULT: 0x80030002 (STG_E_FILENOTFOUND)).
at Microsoft.Office.Interop.Word.ApplicationClass.get_Selection()
verifica questo errore sull'ultima riga del seguente codice:
object wdStory = Word.WdUnits.wdStory;
object wdMove = Word.WdMovementType.wdMove;
WrdApp.Selection.EndKey(ref wdStory, ref wdMove)
Come posso risolvere questo problema?
Funziona su altri computer? Ho rotto il registro l'altro giorno (su un computer di colleghi non meno) e stavo vivendo problemi simili a questo tutti i programmi che usavano componenti COM. Se funziona su un altro computer, spiegherò cosa ho fatto per risolverlo. – Wug
Sì, funziona nel computer di sviluppo. Solo nella macchina di prova non funziona. Forse perché installo (e disinstallo) molte versioni di Office (2007, 2007-64, 2010, 2010-64) – Victor
Oh caro. Bene, quale sistema operativo è in esecuzione la macchina di prova? – Wug