3

Basically trying to interact with a third-party OfficeApp (defined via an XML manifest) in Excel using VBA. More specifically it is an a TaskPaneApp with a clickable icon to launch.

I have tried for a while now but couldn't figure it out. Accessing Application.CommandBars, Application.AddIns, Application.AddIns2 and Application.COMADDIns doesn't seem to work. Googling doesn't give any hints either. Does anyone know if this is possible?

matt
  • 2,857
  • 7
  • 33
  • 58
  • 1
    What is this third-party OfficeApp? Presumably a paid for one? Does it come with any documentation/contact details? I know seems stupid to ask but just in case. I'm guessing there is no documentation, you have been using it at work and are now wondering if you can hook into it? – QHarr Feb 05 '21 at 08:36
  • Hi @QHarr, yes it is a paid add-in with no documentation, and works via an in-Excel browser. While the creators plan to expose automation functionality in the future, I was wondering if there's any way to do that with any generic OfficeApp. – matt Feb 06 '21 at 09:06
  • 2
    I honestly don't know. If I was developing a commerical App I'd rather users didn't meddle with it except through any interfaces I chose to expose (methods/properties). I started reading [this](https://www.add-in-express.com/creating-addins-blog/2012/11/22/develop-excel-task-pane-app/) but didn't really tell me anything useful. What is the nature of the in Excel browser? Can you intercept messages to the target? I thought web browser controls e.g on forms were near extinct and a possible security risk. – QHarr Feb 06 '21 at 09:18
  • Why would you try to take charge of something that isn't yours? – StureS Feb 10 '21 at 18:01

2 Answers2

0

A macro cannot access a private variable declared in an add-in. That puts you in a pretty difficult position.

One option would be to contact the author of the add-in and ask them to do one of the following:

  1. Expose a specific function
  2. Implement the automation functionality you need
  3. Or sell/give you the source code

Another option could be to decompile - but you should check the license of this add-in to see if it's legal. Then add the functionality that you need. However check the license first and terms/conditions. There are situations for older plugins where the author could have lost the original source code or where they give you permission because they don't care anymore.

Have a look at the following: Possible to view source code or decompile XLL Excel add in

Also have a look at the following which details an example of how to call an excel-add-in function from vba: Call Excel Add-In function in macro and specifically https://stackoverflow.com/a/35518426/1688441

Menelaos
  • 23,508
  • 18
  • 90
  • 155
0

Early Binding / Late Binding

Within the VB editor it is possible to reference the Object Library for the Office applications. This reference to the object library is saved within the Excel file itself. Therefore, any time the file is opened the reference to the Object Library is still intact and is already available.

In the Visual Basic Editor select Tools -> References.

read here for more details its what you are looking for I assume .

https://exceloffthegrid.com/using-vba-to-control-other-office-applications/

Dharman
  • 30,962
  • 25
  • 85
  • 135