Get Return Value from Called Macro

G

George Lee

How do you get a return value from macro when called from C#?

Microsoft shows this but how does oApp.GetType().InvokeMember (the call that
invokes the macro) get to return a value? Assume GetMemberStatus takes one
parameter and returns a value such as a long.

…
Access.ApplicationClass oAccess;
oAccess = new Access.ApplicationClass();
oAccess.OpenCurrentDatabase(accessDataBaseName, false, "");
RunMacro(oAccess, new Object[] { "GetMemberStatus", memberID});
…

private void RunMacro(object oApp, object[] oRunArgs)
{
oApp.GetType().InvokeMember("Run",
System.Reflection.BindingFlags.Default |
System.Reflection.BindingFlags.InvokeMethod,
null, oApp, oRunArgs);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top