Q: In C# with EXCEL VSTO addin, how can it be tell if Excel launched by standalone or embedded in Word document?
Short question:
In C# with EXCEL VSTO addin, how can it be tell if Excel launched by standalone or embedded in Word document at early stage of launch sequence?
I'd like to know it if is embedded or not at timing of ThisAddin_Startup() call timing.
I think at this timing worksheet document instance is not available yet.
Note: Word and Excel are Office 365 public release version as of 2022-03.
More specific question:
I'm looking for working sample code of following question, but I need to early stage of launching at ThisAddin_Startup() call timing.
Note: it is reported not working.
More detail question:
Our Excel addin is not working when embedded Excel sheet was opened from Word.
The error dialog message is "The program used to create this object is Excel. That program is either not installed on your computer or it is not responding. To edit this object, install Excel or ensure that any dialog boxes in Excel are closed." At this timing, Excel.exe is task manager as running and disabled.
Then Excel sheet does not open in Word. It is verified that if our addin was disabled it works as expected.
Our plugin has limitation that it would work only Excel launch as standalone mode.
So I'd like to disable our plugin when Excel launched in embedded mode.
Disabling test has done and verified working at ThisAddin_Startup() call timing.
It is right after InternalStartup() call.
At the timing worksheet document instance may not available for reference to tell embedded or not as it is much earlier timing.
(This part is not fully validated.)
So the question is how can it be tell if Excel launch in embedded or standalone at ThisAddin_Startup() call timing?
Or even later timing?
Is there any working code sample or reference document?
Thank you