Results 1 to 3 of 3

Thread: Call word Add-in from Outlook context

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2007
    Posts
    2

    Call word Add-in from Outlook context

    Hi, all!

    I have 2 COMAddIns in my application one for Word, another is for Outlook. The provided functionality almost the same and everything works fine. Until Outlook doesn't use Word as application for view/edit e-mail. In this case I have some problems with showing modal windows ... Probably it will be next topic for this forum.

    So, as I already no, COMAddIn can be retrieved from Application.COMAddIns collection (e.g. by name):

    Code:
    Function GetMyAddIn() As comAddin
        For i = 1 To Me.Application.COMAddIns.Count
            
            If Me.Application.COMAddIns(i).Description = "atriplex' AddIn" Then
            
                Set GetTrinityAddIn = Me.Application.COMAddIns(i)
                Exit Function
            End If
        Next
    End Function
    COMAddIn has property Object which pretend to transmit some callback interface. AddInInstance_OnConnection gets COMAddIn object as argument, so it appears to be possible to make something like this:

    Code:
    Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant)
    
        ' ...
        Dim addInObject As COMAddIn
        
        Set addInObject = AddInInst
        Set addInObject.Object = Me
    
        ' ....    
    End Sub
    But it doesn't work Object can not be assigned and always Nothing!

    My questions are
    Is it possible to invoke some public method of COMAddIn class from Word, without instantiating it again (I can't use another instance)?
    And what is this COMAddIn.Object used for?

    MSDN doesn't get any good answer ...

    FYI: I use MS Office 11.x (2003) with SP2

    Thank you in advance!

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Call word Add-in from Outlook context

    I believe you need to make an AddIn that encompases both Office Apps. I dont have allot of time right now. I may be online tomorrow for a short while so I may be able to help some more then.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2007
    Posts
    2

    Re: Call word Add-in from Outlook context

    Quote Originally Posted by RobDog888
    I believe you need to make an AddIn that encompases both Office Apps. I dont have allot of time right now. I may be online tomorrow for a short while so I may be able to help some more then.
    I don't understand what do you mean, once I've tried to make COMAddIn for both application. Then I had to import corresponding registry keys manually, but whole implementation was quite crappy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width