By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,467 Members | 1,619 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,467 IT Pros & Developers. It's quick & easy.

run Access Macro using c#

P: n/a
I'm trying to run an Access Macro from .NET. My code right
now looks like this:

Access.ApplicationClass oAccess = new
Access.ApplicationClass();
oAccess.Visible = true;
string path = @"c:\ttt\Reports.mdb";

app.DoCmd.RunMacro(("Macro1" as Object), (1 as Object),
(true as Object));

oAccess.DoCmd.Quit(Access.AcQuitOption.acQuitSaveN one);
System.Runtime.InteropServices.Marshal.ReleaseComO bject
(oAccess);
oAccess = null;

I ran it with the debugger and once the control
leaves .NET at the RunMacro line it never returns. I
believe the connection is ok because if I change the name
of the macro to something like "asdasd" i get an error
saying "macro asdasd not found". Also if I create a blank
macro the code executes ok. The macro runs fine if I run
it from access (all it's supopsed to do is send a table
via email).

Any advice would be apreciated

Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.