Just emphasising that this requires a copy of Access on the machine where you will run the code.
Main Topics
Browse All TopicsIs it possible to call an Access macro using c# code? Can you use ADO to do this? What would the code look like?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
That KB article works says macros but it's actually running an Access module, ie VBScript. It doesn't seem to work for Access macros. The error I get whenever I try to call a macro with this code is:
An unhandled exception of type 'System.Reflection.TargetI
BTW, I'm using Access 2003 and .net 1.1. Is there any reason I need to be at .net 2.0?
I found the solution. Here's the code I used:
Access.ApplicationClass oAccess = new Access.ApplicationClass();
oAccess.Visible = true;
oAccess.OpenCurrentDatabas
// Run the macro
oAccess.DoCmd.RunMacro(("m
(true as Object));
Console.WriteLine("Macro Complete");
// Quit Access and clean up.
oAccess.DoCmd.Quit(Access.
System.Runtime.InteropServ
oAccess = null;
Business Accounts
Answer for Membership
by: sabeeshPosted on 2007-07-23 at 08:00:00ID: 19548057
http://support.microsoft.c om/kb/3066 83