Excel Ole Automation Fails Office 365

  • Thread starter Thread starter cjdlv
  • Start date Start date
C

cjdlv

Guest
I have a c# app that when a user clicks an Export to Excel button it opens Excel, imports a text file, and formats the Excel spreadsheet. However, when running this app on a PC that has Office 365 when the Export to Excel function is called it causes an Exception (Unable to cast COM OBJECT OF TYPE 'Microsoft.Office.Interop.Excel._Application'. This operation failed because the QueryInterface call on the COM component...). The Excel version of Office 365 is 15.0.0.0. This function call works on Excel version 14.0.0.0 and prior versions (Desktop Excel).

I'm able to see the Excel object get created on the Office 365 PC:

Excel.Application objExcel = new Excel.Application();

The Exception happens when I try to open the Text File using the following method:

objExcel.Workbooks.OpenText(strFileName,.......);

Any ideas or help would be appreciated. Thank you.

Continue reading...
 
Back
Top