The technique described in MS KB article 306683 - in particular, the RunMacro function defined there should allow you to call the VBA Macro from C # code: you define the RunMacro function
private void RunMacro(object oApp, object[] oRunArgs) { oApp.GetType().InvokeMember("Run", System.Reflection.BindingFlags.Default | System.Reflection.BindingFlags.InvokeMethod, null, oApp, oRunArgs); }
and then call your macro like this:
RunMacro(oApp, new object[] {"NameOfMyMacro"})
or
RunMacro(oApp, new object[] {"NameOfMyMacro", "some", 3, "parameters"})
oApp is a Word.Application object, which I'm sure is available somewhere in the Word add-in.
Heinzi
source share