是否可以调用VBA函数(在Access中),该函数从外部世界获取两个字符串参数(例如来自c#但其他人也会这样做)?
答案 0 :(得分:1)
答案 1 :(得分:1)
这是从C#到我过去用来创建类似功能的访问数据库功能的调用示例。
private void btnRunVBAFunction_Click(object sender, System.EventArgs e)
{
Access.Application acApp = new Access.ApplicationClass();//create msaccess
application
acApp.OpenCurrentDatabase(@"C:\temp\db1.mdb",false ,null);//open mdb file
object oMissing = System.Reflection.Missing.Value;
//Run the Test macro in the module
acApp.Run("Test",ref oMissing,ref oMissing,ref oMissing,ref oMissing,
ref oMissing,ref oMissing,ref oMissing,ref oMissing,
ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing
,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing
,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing
,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing
,ref oMissing,ref oMissing);
acApp.Quit();//exit application
}
这是我过去使用的网站。
http://bytes.com/topic/c-sharp/answers/255310-run-microsoft-access-module-vs-net-c