Probleb with opening word files RRS feed

  • Question

  • I've created COM Add-in for office applications using VS 2010.

    It works fine with Excel, Power Point and Outlook, but it causes problem to Word.

    I have 2 computers:
    1. Win7, Office2007
    2. Win XP, Office2007

    On the first computer, if I am trying to open Word file by double-clicking its' icon in Windows Explorer - the Word program is opened with the following error message:"there was a problem sending the command to the program". The file is not opened. In order to open the file, I have to double-click the icon again.

    On the second computer there is the same problem, but without error message.

    If I disable add-in on both computers, the Word works normally.

    I am looking for a solution on the web for quite a long time, but no success.

    You suggestions will be appreciated.


    Thursday, January 24, 2013 9:47 PM

All replies

  • debugging and logging are your friends now. Show us your code for add-in OnConnect/Start, whatever you use.
    Friday, January 25, 2013 6:52 AM
  • Thanks for your reply DamianD, here is the code:

    'Reserved Error numbers for this module: 1 : 200
    Imports Extensibility
    Imports System.Runtime.InteropServices

    Imports Office = Microsoft.Office.Core
    Imports Word = Microsoft.Office.Interop.Word
    Imports Excel = Microsoft.Office.Interop.Excel
    Imports PowerPoint = Microsoft.Office.Interop.PowerPoint
    Imports Outlook = Microsoft.Office.Interop.Outlook

    Imports Microsoft.Office.Core

    'Imports System.Windows.Forms

    #Region " Read me for Add-in installation and setup information. "
    ' When run, the Add-in wizard prepared the registry for the Add-in.
    ' At a later time, if the Add-in becomes unavailable for reasons such as:
    '   1) You moved this project to a computer other than which is was originally created on.
    '   2) You chose 'Yes' when presented with a message asking if you wish to remove the Add-in.
    '   3) Registry corruption.
    ' you will need to re-register the Add-in by building the test32Setup project,
    ' right click the project in the Solution Explorer, then choose install.
    #End Region

    <GuidAttribute("DD60B6F9-17BA-43C9-A4AE-FACAB4033651"), ProgIdAttribute("test32.Connect")> _
    Public Class Connect

        Implements Extensibility.IDTExtensibility2, Office.IRibbonExtensibility

        Private applicationObject As Object
        Private addInInstance As Object

        Private testRibbon As IRibbonUI

        Public Sub OnBeginShutdown(ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnBeginShutdown
        End Sub

        Public Sub OnAddInsUpdate(ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnAddInsUpdate
        End Sub

        Public Sub OnStartupComplete(ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnStartupComplete

        End Sub

        Public Sub OnDisconnection(ByVal RemoveMode As Extensibility.ext_DisconnectMode, ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnDisconnection
        End Sub

        Public Sub OnConnection(ByVal application As Object, ByVal connectMode As Extensibility.ext_ConnectMode, ByVal addInInst As Object, ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnConnection

            addInInstance = addInInst 'Part of shared add in structure

            If TypeOf (application) Is Word.Application Then
                applicationObject = CType(application, Word.Application)
                officeApplication = "Word"
            ElseIf TypeOf (application) Is Excel.Application Then
                applicationObject = CType(application, Excel.Application)
                officeApplication = "Excel"
            ElseIf TypeOf (application) Is PowerPoint.Application Then
                applicationObject = CType(application, PowerPoint.Application)
                officeApplication = "PowerPoint"
            ElseIf TypeOf (application) Is Outlook.Application Then
                applicationObject = CType(application, Outlook.Application)
                officeApplication = "Outlook"
            End If
        End Sub

        Public Function GetCustomUI(ByVal RibbonID As String) As String Implements Microsoft.Office.Core.IRibbonExtensibility.GetCustomUI
            Return test32.My.Resources.testUI

        End Function

        Public Sub testRibbonLoaded(ByVal ribbon As IRibbonUI)

            'Public Sub ribbonLoaded(ByVal ribbon As IRibbonUI)
            'Getting and setting ribbon controls values

        End Sub

    End Class

    Friday, January 25, 2013 7:33 AM
  • ok, add try/catch for your GetCustomUI and OnConnection methods and log or display errors. Share results with us.
    Friday, January 25, 2013 8:06 AM