通过互操作为 Microsoft Access 创建宏 [英] Create a macro for Microsoft Access via Interop

查看:11
本文介绍了通过互操作为 Microsoft Access 创建宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 C# 使用 Microsoft Access 中的 Interop 库以与 Word、Excel 或 PowerPoint 类似的方式创建新宏?在其他应用程序中,您可以访问 Microsoft.Vbe.Interop._VBComponent,它允许您通过 DocumentWorksheetPresentation 类.看起来 Access 没有类似的东西.Access 有一个 AllMacros 列表,但它似乎是只读的.我知道如何在项目中执行宏,但我需要能够动态添加宏.如果有人能指出我正确的方向,我将不胜感激.

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 日)

same question 表示您可以使用 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆