I am working on the same solution where I need to update the connection lines of several files in Bulk.But, its work for MS Excel 2010, and not for Excel 2013.
Exception result: "Exception from HRESULT: 0x800A03EC"
Code snippet:
Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook ppWorkbook = (Microsoft.Office.Interop.Excel.Workbook)xlApp.Workbooks.Open(fileNameBox.Text);
Microsoft.Office.Interop.Excel.Connections connections = ppWorkbook.Connections;
string newConnectionString = "Connection String";
try
{
foreach (Microsoft.Office.Interop.Excel.WorkbookConnection connection in connections)
{
connection.OLEDBConnection.Connection = newConnectionString;
}
}
catch (Exception ex)
{ }
This happens when you assign an OLEDBConnection connection string. Requires a solution for MS Excel 2013 C #.
source
share