Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Word 中添加了一个 Excel 工作表对象。Excel 附加了一个 COM 插件。知道如何知道 Excel 是独立运行还是作为嵌入式对象运行?
当嵌入的 Excel 对象在 Word 中被激活(双击)时,附加到 Excel 的 COM 插件会加载。我在 OnConnection(...) 或其他可以告诉 Excel 对象状态的方法中寻找某种属性或参数。
尝试对象的UserControl属性Application。
UserControl
Application
UserControl 属性如果应用程序可见或者它是由用户创建或启动的,则为真。如果您使用 CreateObject 或 GetObject 函数以编程方式创建或启动应用程序,并且应用程序被隐藏,则为 False。读/写布尔值。
自从我不得不使用这个属性以来已经很长时间了,所以我不确定它是否会对您的具体情况有所帮助。