Calling word Macros from .Net
While using Word automation with .Net sometimes it is required ti call, word macro’s from C# or VB.Net.
Here is the code to call word macros from VB.Net.
Dim WordApp As New Microsoft.Office.Interop.Word.Application
CType(WordApp, Object).GetType().InvokeMember("Run", Reflection.BindingFlags.Default Or Reflection.BindingFlags.InvokeMethod, Nothing, CType(WordApp, Object), New Object() {"helloworld"})
In the code, helloworld is the macro name.Or you can simply call WordApp.Run("helloworld") will also works fine.
You can also refer link from Microsoft
http://support.microsoft.com/kb/306683
Categories: .Net, Miscellaneous, Office Interoperability .Net, Interop, Office Interoperability, VB.Net, Word
