Create a macro for Microsoft Access via Interop(通过互操作为 Microsoft Access 创建宏)
问题描述
是否可以使用 C# 使用 Microsoft Access 中的 Interop 库以与 Word、Excel 或 PowerPoint 类似的方式创建新宏?在其他应用程序中,您可以访问 Microsoft.Vbe.Interop._VBComponent
,它允许您通过 Document
、Worksheet
或 Presentation
类.看起来 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 创建宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:通过互操作为 Microsoft Access 创建宏


基础教程推荐
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01