Excel Interop in Rhino 8 Script Editor (Python 2)

I am having trouble with the new script editor, running below code gives an error in Rhino 8 while it runs fine in Rhino 7? Any ideas?

The error: IOError: System.IO.IOException: Could not add reference to assembly Microsoft.Office.Interop.Excel

#! python 2
import clr
from Microsoft.Office.Interop import Excel

Found a fix here, apperently this has to do with the new .Net Core 7 versus .Net 4.2 in Rhino 7.

Another fix is to use clr.AddReferenceToFileAndPath("path_to_dll_file"). This does work with the new .NET Core 7 of Rhino 8.

For some reason using clr.AddReference() does not find the Windows Assembly folder containing the .dll files for Interop Assemblies (such as Office, etc.)

1 Like