Calling my Outlook AddIn from VBA

Add-in Express™ Support Service
That's what is more important than anything else

Calling my Outlook AddIn from VBA
I want to allow 3rd parties to call certain routines in my outlook add 
Roger Middlebrook


Guest


I think you may have posted an answer to this before but I can't find it.

I have a procedure in my Outlook add-in called Hello (as a test). I have been trying to access it using VBA to prove that 3rd parties will be able to call my routine.

If I reference my type library in VBA, I can use the following code:


  Dim AI As KappOlk
  Const ADDIN_ID = "KapprisOutlook.KappOlk"

  Set AI = Application.COMAddIns.Item(ADDIN_ID).Object
  
  AI.Hello
  

This always errors because the Object property of the add-in always returns Nothing. I think the VBA is OK. What do I need to do to get a usable reference to my add-in?

Thanks
Posted 21 Sep, 2009 11:50:32 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Roger,

Probably you misspell your add-in ProgID. To check this, run the following code in VBA and then open the Immediate Window (Ctrl+G):

Sub GetComAddins()
Dim addin As Office.COMAddIn
Dim i As Integer
For i = 1 To Application.COMAddIns.Count
  Set addin = Application.COMAddIns.Item(i)
  Debug.Print "ProgId = """ + addin.progID + """; Connected = " + CStr(addin.Connect)
Next i
End Sub



Andrei Smolin
Add-in Express Team Leader
Posted 22 Sep, 2009 06:07:43 Top
Roger Middlebrook


Guest


I just copied your code straight into Outlook and (amongst other things)the debug window now contains:

ProgId = "KapprisOutlook.KappOlk"; Connected = True


The Object property of the addin still returns Nothing.

I have also tried creating a completely new add-in and the results are the same - the COMAddIn in Outlook has an Object property that returns Nothing.
Posted 22 Sep, 2009 06:38:01 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Roger,

What Add-in Express build do you have?


Andrei Smolin
Add-in Express Team Leader
Posted 22 Sep, 2009 10:21:47 Top
Roger Middlebrook


Guest


Add-in Express 4.4.410 Premium
Outlook 2003 SP3
Windows XP SP3
Delphi 2006 Version 10.0.2288.42451 Update 2
Posted 22 Sep, 2009 10:30:37 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Roger,

This problem was fixed in the latest build of version 2008. It's available on the download page (see the menu above).


Andrei Smolin
Add-in Express Team Leader
Posted 22 Sep, 2009 10:54:13 Top