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 创建宏


- C# 通过连接字符串检索正确的 DbConnection 对象 2022-01-01
- 是否可以在 .Net 3.5 中进行通用控件? 2022-01-01
- 带问号的 nvarchar 列结果 2022-01-01
- Windows 喜欢在 LINUX 中使用 MONO 进行服务开发? 2022-01-01
- Azure Active Directory 与 MVC,客户端和资源标识同一 2022-01-01
- 使用 rss + c# 2022-01-01
- CanBeNull和ReSharper-将其用于异步任务? 2022-01-01
- 为什么 C# 中的堆栈大小正好是 1 MB? 2022-01-01
- 在 C# 中异步处理项目队列 2022-01-01
- 在 LINQ to SQL 中使用 contains() 2022-01-01