How do I get the *actual* host application instance?
问题 I have this code in a C# add-in for the VBE (emphasis "VBE": it's not a MS-Office add-in): public abstract class HostApplicationBase<TApplication> : IHostApplication where TApplication : class { protected readonly TApplication Application; protected HostApplicationBase(string applicationName) { Application = (TApplication)Marshal.GetActiveObject(applicationName + ".Application"); } Where TApplication is a MS-Office interop Application class, for example, a Microsoft.Office.Interop.Excel