0
votes

I'm working on a project that involves migrating macros in a Word Template to VB.NET making use of VSTO. We've been able to create the Word Template and migrate the code to VB.NET just fine, however we need to action a certain VSTO method from a separate .NET application.

Previously, we were able to achieve this in VBA by doing this:

Word.Application.Run(MacroName:="MyDocument.MyModule.MyMethod")

There are a few articles explaining how this can be achieved with Application and Document-level customizations, but we've yet to find any information on how this can be done with a VSTO Document-level Word Template.

We've already tried a number of different approaches including:

However neither of these seems to be applicable for document-level templates. In addition to this we also tried adding a button to the ribbon which fires the required method, and attempting to access it from our .NET application using Word.Application.CommandBars.FindControl()

Some more info: the VSTO Word Template was created using VS2013, and the separate .NET application has been developed on VS2010. Both applications run .NET Framework 4.

1

1 Answers

0
votes

You can use standard .Net mechanisms such as WCF (.Net Remoting) and etc. Consider your document level add-in as a separate application.

In case of application level add-ins, you can call them directly. See Calling Code in Application-Level Add-ins from Other Office Solutions for more information.