通过互操作的Microsoft Access创建宏 [英] Create a macro for Microsoft Access via Interop
问题描述
是否有可能建立在Microsoft Access使用互操作的库以类似的方式为Word,Excel或PowerPoint一个新的宏使用C#?在其它应用中,你有机会获得 Microsoft.Vbe.Interop._VBComponent
,它允许你注入新的宏,通过文件
,工作表
或 presentation
类。它看起来并不像访问有什么与此类似。访问有一个 AllMacros
列表中,但它似乎是只读的。我知道如何执行宏一旦它在这个项目,但我需要能够动态添加宏。我将非常AP preciate人,可以在正确的方向指向我。
Is it possible to create a new macro using C# using the Interop library in Microsoft Access in a similar fashion as Word, Excel, or PowerPoint? In the other applications, you have access to Microsoft.Vbe.Interop._VBComponent
, which allows you to inject new macros, through the Document
, Worksheet
, or Presentation
classes. It doesn't look like Access has anything similar to this. Access has an AllMacros
list, but it appears to be read-only. I know how to execute the macro once it's in the project, but I need to be able to add macros dynamically. I would greatly appreciate anyone that could point me in the correct direction.
推荐答案
从answers.microsoft.com措施:
Taken from answers.microsoft.com:
在Access宏是一个特殊的数据库对象,不像在其他Office应用程序,其中一个宏是一个简单的VBA程序没有参数。据我知道你不能以编程方式创建Access宏。的 -HansV MVP(2011年4月27日)的
A macro in Access is a special database object, unlike in other Office applications where a macro is simply a VBA procedure without arguments. As far as I know you can't create an Access macro programmatically. -HansV MVP (April 27, 2011)
有张贴在<一个又一个的答案href="http://answers.microsoft.com/en-us/office/forum/officeversion_other-customize/how-to-programmatically-create-a-ms-access-macro/177cf24e-5870-e011-8dfc-68b599b31bf5?msgId=c46f263f-9270-e011-8dfc-68b599b31bf5"相对=nofollow>同样的问题,说你可以创建新的code /使用VB扩展库VBA对象。
There is another answer posted at the same question that says you can create new code/VBA objects using the VB Extensibility Library.
这篇关于通过互操作的Microsoft Access创建宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!