Excel error HRESULT: 0x800A03EC while trying to get range with cell’s name

The error code 0x800A03EC (or -2146827284) means NAME_NOT_FOUND; in other words, you’ve asked for something, and Excel can’t find it. This is a generic code, which can apply to lots of things it can’t find e.g. using properties which aren’t valid at that time like PivotItem.SourceNameStandard throws this when a PivotItem doesn’t have a filter … Read more

How do I create a real-time Excel automation add-in in C# using RtdServer?

(As an alternative to the approach described below you should consider using Excel-DNA. Excel-DNA allows you to build a registration-free RTD server. COM registration requires administrative privileges which may lead to installation headaches. That being said, the code below works fine.) To create a real-time Excel automation add-in in C# using RtdServer: 1) Create a … Read more

How to open an Excel file in C#?

You need to have installed Microsoft Visual Studio Tools for Office (VSTO). VSTO can be selected in the Visual Studio installer under Workloads > Web & Cloud > Office/SharePoint Development. After that create a generic .NET project and add a reference to Microsoft.Office.Interop.Excel via ‘Add Reference… > Assemblies’ dialog. Application excel = new Application(); Workbook … Read more

Excel Interop – Efficiency and performance

When using C# or VB.Net to either get or set a range, figure out what the total size of the range is, and then get one large 2 dimensional object array… //get values object[,] objectArray = shtName.get_Range(“A1:Z100”).Value2; iFace = Convert.ToInt32(objectArray[1,1]); //set values object[,] objectArray = new object[3,1] {{“A”}{“B”}{“C”}}; rngName.Value2 = objectArray; Note that its important … Read more