VSTO Visual studio word-add in problem. RRS feed

  • Question

  • Error message:  I receive the following error:  {"Unable to cast object of type 'Microsoft.Office.Tools.Word.DocumentImpl' to type 'Microsoft.Office.Interop.Word.Document'."}

    Code:  When executing the following code:

    Dim sCode As String
            Dim currentDocument As Word.Document = Me.Application.ActiveDocument
            Dim doc As Word.Document = Globals.Factory.GetVstoObject(currentDocument)


    I also have the following warning:

    Could not determine the dependencies of the COM reference "WordClientPkgLib". Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY))

    I have reinstalled Visual Studio, updated it, repaired office, reinstalled VSTO, but still have the same error.  The VSTO function above worked perfectly yesterday--so I have no idea what happened and, while I made changes to other sections of the code, none should have affected this section.  Please help.

    Wednesday, June 18, 2014 10:54 PM

All replies