![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hi newsgroup,
is it possible to call public functions of a COM-AddIn (made with VSTO 2005) from outside, especially from a VBA-macro? Any help would be appreciated. Kind regards, Steffen |
Ads |
#2
|
|||
|
|||
![]()
Yes, it's possible. For an example download one of the VSTO templates I have
up for Outlook 2007 and look at how I handle setting up calls from the outside to functions in the COM addin. The same would apply for other versions of Outlook as well with VSTO. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Steffen Grellmann" wrote in message ... Hi newsgroup, is it possible to call public functions of a COM-AddIn (made with VSTO 2005) from outside, especially from a VBA-macro? Any help would be appreciated. Kind regards, Steffen |
#3
|
|||
|
|||
![]()
Hi Ken,
thank you very much for replying. Yes, it's possible. For an example download one of the VSTO templates I have up for Outlook 2007 and look at how I handle setting up calls from the outside to functions in the COM addin. The same would apply for other versions of Outlook as well with VSTO. But how do I call the CalledFromOutside() from my VBA-Project (which is a global template in Word with a reference to the Outlook object library)? Kind regards, Steffen |
#4
|
|||
|
|||
![]()
In the VBA code you'd do something like this, assuming your addin ProgID was
"myAddin": Dim oAddin As Office.ComAddin ' oOL is an Outlook.Application object Set oAddin = oOL.COMAddins.Item("myAddin") If Not (oAddin Is Nothing) Then If oAddin.Connect = True Then 'if addin running Dim addinObject As Object Set addinObject = oAddin.Object If Not (addinObject Is Nothing) Then addinObject.CalledFromOutside() ' this is the call End If End If End If -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Steffen Grellmann" wrote in message ... Hi Ken, thank you very much for replying. Yes, it's possible. For an example download one of the VSTO templates I have up for Outlook 2007 and look at how I handle setting up calls from the outside to functions in the COM addin. The same would apply for other versions of Outlook as well with VSTO. But how do I call the CalledFromOutside() from my VBA-Project (which is a global template in Word with a reference to the Outlook object library)? Kind regards, Steffen |
#5
|
|||
|
|||
![]()
Hi Ken,
thank you very much for replying. Dim oAddin As Office.ComAddin ' oOL is an Outlook.Application object Set oAddin = oOL.COMAddins.Item("myAddin") If Not (oAddin Is Nothing) Then If oAddin.Connect = True Then 'if addin running Dim addinObject As Object Set addinObject = oAddin.Object If Not (addinObject Is Nothing) Then addinObject.CalledFromOutside() ' this is the call End If End If End If The oOL.COMAddins.Item supplies me the AddIns stored in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Outlo ok\Addins and not my VSTO 2007 SE AddIn stored in HKEY_CURRENT_USER\Software\Microsoft\Office\Outloo k\Addins How do I access the VSTO AddIn this way? Kind regards, Steffen |
#6
|
|||
|
|||
![]()
That makes no sense at all. It shouldn't matter one way or the other where a
COM addin is registered, in either HKCU or HKLM. If you look in the registry for your VSTO addin are you matching the registration name exactly in your code? -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Steffen Grellmann" wrote in message ... Hi Ken, thank you very much for replying. Dim oAddin As Office.ComAddin ' oOL is an Outlook.Application object Set oAddin = oOL.COMAddins.Item("myAddin") If Not (oAddin Is Nothing) Then If oAddin.Connect = True Then 'if addin running Dim addinObject As Object Set addinObject = oAddin.Object If Not (addinObject Is Nothing) Then addinObject.CalledFromOutside() ' this is the call End If End If End If The oOL.COMAddins.Item supplies me the AddIns stored in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Outlo ok\Addins and not my VSTO 2007 SE AddIn stored in HKEY_CURRENT_USER\Software\Microsoft\Office\Outloo k\Addins How do I access the VSTO AddIn this way? Kind regards, Steffen |
#7
|
|||
|
|||
![]()
Sorry, the registry confusion has been my fault. I first had an
underline in the registration name of my AddIn like "Test_2003". Without that underline oAddin is initiated correctly and the item collection is returning my AddIn as well as the other ones. Nevertheless oAddin.Connect is still returning False for me. Although you commented "'oOL is an Outlook.Application object" I had to put in the following lines in order to prevent a compilation error in Words VBA editor: Dim oOL As Object Set oOL = outlook.Application Has this to do with my issue? Developing environment is VSTO SE 2005 and Word 2003/VBA with a reference set to the Outlook object model. On Wed, 23 Jul 2008 09:54:21 -0400, "Ken Slovak - [MVP - Outlook]" wrote: That makes no sense at all. It shouldn't matter one way or the other where a COM addin is registered, in either HKCU or HKLM. If you look in the registry for your VSTO addin are you matching the registration name exactly in your code? -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Steffen Grellmann" wrote in message .. . Hi Ken, thank you very much for replying. Dim oAddin As Office.ComAddin ' oOL is an Outlook.Application object Set oAddin = oOL.COMAddins.Item("myAddin") If Not (oAddin Is Nothing) Then If oAddin.Connect = True Then 'if addin running Dim addinObject As Object Set addinObject = oAddin.Object If Not (addinObject Is Nothing) Then addinObject.CalledFromOutside() ' this is the call End If End If End If The oOL.COMAddins.Item supplies me the AddIns stored in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Outlo ok\Addins and not my VSTO 2007 SE AddIn stored in HKEY_CURRENT_USER\Software\Microsoft\Office\Outloo k\Addins How do I access the VSTO AddIn this way? Kind regards, Steffen |
#8
|
|||
|
|||
![]()
If Outlook is started "headless" some versions of VSTO won't initialize the
addin. They only initialize the addin when Outlook is started with some UI such as an Explorer or Inspector. That may have something to do with your problem. Another possibility is that since VSTO 2005 SE doesn't fire its Startup() event until OnStartupComplete() fires in the extensibility interfaces that you are checking for Connect too early. I didn't bother writing complete code, just a snippet and indicated that you need an Outlook.Application object which I called oOL in my code snippet. So I would expect errors in Word VBA code unless you did instantiate an Outlook.Application object. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Steffen Grellmann" wrote in message ... Sorry, the registry confusion has been my fault. I first had an underline in the registration name of my AddIn like "Test_2003". Without that underline oAddin is initiated correctly and the item collection is returning my AddIn as well as the other ones. Nevertheless oAddin.Connect is still returning False for me. Although you commented "'oOL is an Outlook.Application object" I had to put in the following lines in order to prevent a compilation error in Words VBA editor: Dim oOL As Object Set oOL = outlook.Application Has this to do with my issue? Developing environment is VSTO SE 2005 and Word 2003/VBA with a reference set to the Outlook object model. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to call CALLBACK functions from COM Add-In | K.VenkataRamana | Add-ins for Outlook | 1 | July 9th 08 02:47 PM |
Outlook Addin functions only one time after Outlook is started | Mo | Add-ins for Outlook | 5 | February 25th 08 02:44 PM |
Addin call to external dll | JahMic | Add-ins for Outlook | 3 | April 10th 07 07:29 PM |
Macro functions disabled? | Sebastian | Outlook and VBA | 2 | January 18th 07 09:01 AM |
Call macro stored in Excel workbook from Outlook's macro | Gvaram | Outlook and VBA | 5 | October 4th 06 06:26 AM |