DannyC wrote:It took me some time to locate Microsoft.Office.Interop.Excel.dll but found it (for the benefit of others reading this)
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14
The location will vary from machine to machine, depending on the version of Office installed. The version independent programmatic ID I mentioned is a way of insulating your code from these various versions installed on different machines. Note this only works with Assemblies which have a COM interop layer - which Microsoft Office does have.
The location on my machine was C:\Program Files (x86)\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA\Office15\. The location doesn't really matter - but the Assembly Full Name does - when I chose the assembly in that location it loads the Assembly and obtains the Full Name "Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c". It's this Full Name that we use to find assemblies when we load a plugin - not the location. On a system with Office version 14 installed, that assembly reference may fail to resolve - and users logging into Jiwa with that plugin enabled will receive errors.
If you needed to find the reference after importing my plugin, then that demonstrates and proves the problem.
I strongly recommend once you have your plugin finished, remove the reference and use the version independent technique for creating the Excel object before deploying it live - or you will encounter issues.
i.e.:
- Code: Select all
Try
Dim excel As Object = CreateObject("Excel.Application")
Catch ex As System.Exception
Throw New System.Exception("Microsoft Office is not installed!", ex)
End Try
Mike