Embedded Office Application - How to know whether the app is running or the object is embedded

StackOverflow https://stackoverflow.com/questions/3042527

  •  27-09-2019
  •  | 
  •  

Question

I am adding an Excel Worksheet object inside Word. Excel has a COM addin attached to it. Any idea how one can know whether Excel is running independently or as an embedded object?

The COM Addin attached to Excel loads when the embedded Excel object is activated (double-clicked) inside Word. I am looking for some kind of a property or a parameter in OnConnection(...) or other method that can tell the state of Excel object.

Was it helpful?

Solution

Try the UserControl property of the Application object.

UserControl Property True if the application is visible or if it was created or started by the user. False if you created or started the application programmatically by using the CreateObject or GetObject functions, and the application is hidden. Read/write Boolean.

It has been a long time since I had to use this property, so I am not sure it will help in your specific case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top