简体   繁体   English

可以在Office应用程序外部调用/使用VBE吗?

[英]Can VBE be invoked/used OUTSIDE of an Office Application?

This may be a silly question - I haven't found anything on Google about this. 这可能是一个愚蠢的问题-我在Google上还没有找到任何相关信息。 No new programs populate in the task manager when VBE is opened from an Office Application, and I don't see an executable that looks probable. 从Office应用程序中打开VBE时,任务管理器中没有新程序填充,而且我看不到看起来可能的可执行文件。 DLL maybe? DLL也许?

Some Office applications provide the Run method for the Application class. 某些Office应用程序为Application类提供Run方法。 For example, see Run Excel Macro from Outside Excel Using VBScript From Command Line . 例如,请参阅使用外部VBScript从命令行从外部Excel运行Excel宏

Yes, you can call VBA macro at runtime. 是的,您可以在运行时调用VBA宏。

There are applications that don't provide any specific methods for that, for example, Outlook. 有些应用程序没有为此提供任何特定的方法,例如Outlook。 In that case you can use the late-binding technology (see Type.InvokeMemeber) - see Calling Outlook VBA Macro from outside (VB/VBScript/C#) . 在这种情况下,您可以使用后期绑定技术(请参阅Type.InvokeMemeber)-请参阅从外部调用Outlook VBA宏(VB / VBScript / C#)

You can invoke a CommandBarButton 's OnAction macro as a proxy for Application.Run . 您可以调用CommandBarButtonOnAction宏作为Application.Run的代理。

For details, see this question How can I run a macro from a VBE add-in, without Application.Run? 有关详细信息,请参见此问题。 如何在没有Application.Run的情况下从VBE外接程序运行宏?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM