开发者

Invoke a COM addin option from VBA

开发者 https://www.devze.com 2022-12-28 21:35 出处:网络
Can I invoke an option on a COM Add-in from a VBA macro in Word or Excel 2007? The COM Add-in was written using VSTO – it adds a custom ribbon tab with a number of options that I want to execute from

Can I invoke an option on a COM Add-in from a VBA macro in Word or Excel 2007? The COM Add-in was written using VSTO – it adds a custom ribbon tab with a number of options that I want to execute from a VBA macro.

  • I can reference the add-in using Application.COMAddIns("MyAddinName") but I can’t find an option to invoke an option.
  • I’ve also played around with the Application.CommandBars collection, and can see that you can execute an option using CommandBarControl.Ex开发者_如何学运维ecute but I can’t find my command bar in the Application.CommandBars collection.

Does anyone know if this is possible?


In case you're still interested in the solution: I've found this blog on the web (following this StackOverflow question).

You can expose functionality within your Add-In by overriding the AddIn.RequestComAddInAutomationService() method and returning a class you want to provide.

In your situation you could define a class with a method which invokes the same code in your add-in as the ribbon button does, and expose that method to VBA.

0

精彩评论

暂无评论...
验证码 换一张
取 消