How do I add a reference to an Excel object library in a .Net script since I can not add a reference to a COM object?

When the Microsoft Office products are installed on the system verify that the .NET Programmability Support option is selected at the time of the install. This option is on by default. This option creates a Primary Interop Assembly (PIA).

After the install of the Office products launch SilkTest 2010 or later and open a new .Net script. From the Properties pane right-click on the References node of the tree and select Add Reference. Click on the Browse button and navigate to the Microsoft.Office.Interop.Excell.dll assembly.

Once the reference has been added to the script it helps in the scripting effort to import the reference to the SilkTest 2010 .Net script. The main reasons for this is after importing it is not necessary to type the fully qualified name to get to the object’s functions, methods or events.

It is now possible to create a script that can execute against Microsoft Office objects.