Interop with Word and Excel

unhandled

#1

Hello,

I am trying to understand how MS Word and Excel interop works with GH.

In the following code, the VB script is able to access Word application, but not Excel. However there are no assemblies linked for the both. How GH can find the Word application ?

JLH


#2

Hello @JLH,

When you use the GetActiveObject Method, it is getting the current instance of Excel.

If you want to do a cross program GH component, then I suggest you to reference DLLs : Microsoft.Office.Interop.Word and Microsoft.Office.Interop.Word.

Then you can do whatever you want with Word/Excel from wherever you want, including GH.

To get it started, just create a new instance of Interop.Word.Application f.ex., it will start the program if not already opened. I should have both SDKs somewhere if you cannot find them.

–Xavier


Big VB component (involuntarily) runs in a loop