Working with Office 2013 RRS feed

  • Question

  • Hello,

    I have a COM add-in developed in VB.NET (VS 2010).

    It works with Word, Outlook, PowerPoint and Excel 2007 and 2010.

    However, it doesn't work with Excel and Outlook 2013, while working good with Word and PowerPoint 2013.

    I've compiled it with references to Office 15, but it didn't help.

    Here is a code that I use:

    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
    Public Class Connect
        Implements Extensibility.IDTExtensibility2, Office.IRibbonExtensibility
    Private applicationObject As Object
        	Private addInInstance As Object
    	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 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)
                    objWord = DirectCast(System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application"), Word.Application)
                ElseIf TypeOf (application) Is Excel.Application Then
                    applicationObject = CType(application, Excel.Application)
                    objExcel = DirectCast(System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application"), Excel.Application)
                ElseIf TypeOf (application) Is PowerPoint.Application Then
                    applicationObject = CType(application, PowerPoint.Application)
                    objPowerPoint = DirectCast(System.Runtime.InteropServices.Marshal.GetActiveObject("PowerPoint.Application"), PowerPoint.Application)
                ElseIf TypeOf (application) Is Outlook.Application Then
                    applicationObject = CType(application, Outlook.Application)
                    objOutlook = DirectCast(System.Runtime.InteropServices.Marshal.GetActiveObject("Outlook.Application"), Outlook.Application)
                End If
    End Sub

    Thanks for your help,


    Friday, August 2, 2013 8:08 PM

All replies

  • Hi Alex,

    I have one question about you COM add-in. Can you share with us how do you debug and deploy it?

    Friday, August 9, 2013 3:38 AM
  • Hello,

    VS has predefined template for creating COM add-ins for office.

    In order to deploy it, I "build" the solution (right click "MyProject" in solution explorer and select "Build".

    Then I "build" the setup (right click "MyProjectSetup" in solution explorer and select "Build").

    Then I install it (right click "MyProjectSetup" in solution explorer and select "Install").

    After that I can test add-in with Office.

    Friday, August 9, 2013 12:30 PM