Error prevents calculating graph metrics

Jan 15, 2014 at 3:40 PM
I have successfully installed NodeXL and drawn graphs on my Windows 8 (64-bit) machine running Excel 2010 (32-bit). I can even group vertices by attribute. However, I am unable to Calculate Metrics or Create Subgraph Images. Specifically, after clicking on "Calculate Metrics" I receive the error message below. Clicking "Create" for subgraph images creates a similar error. Is this a known bug or a configuration issue on my end? Without the ability to calculate metrics the tool will not be useful to me.

Thank you


An unexpected problem occurred. If it occurs again, please copy the details to the clipboard by typing Ctrl-C, then post the details to


[TargetException]: Object does not match target type.

Server stack trace:

at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)

at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)

at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)

at Microsoft.VisualStudio.Tools.Applications.InteropProxyImpl.OnImportedMethodInvoked(MethodInfo methodInfo, Object[] args, Exception& exception)

Exception rethrown at [0]:

at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

at Microsoft.Office.Interop.Excel._Workbook.get_Sheets()

at Smrf.AppLib.ExcelUtil.TryGetWorksheet(Workbook workbook, String worksheetName, Worksheet& worksheet)

at Smrf.AppLib.ExcelTableUtil.TryGetTable(Workbook workbook, String worksheetName, String tableName, ListObject& table)

at Smrf.NodeXL.ExcelTemplate.PerWorkbookSettings.TryGetPerWorkbookSettingsTable(ListObject& oPerWorkbookSettingsTable)

at Smrf.NodeXL.ExcelTemplate.PerWorkbookSettings.GetAllSettings()

at Smrf.NodeXL.ExcelTemplate.PerWorkbookSettings.TryGetValue(String settingName, Type valueType, Object& value)

at Smrf.NodeXL.ExcelTemplate.PerWorkbookSettings.get_WorkbookSettings()

at Smrf.NodeXL.ExcelTemplate.NodeXLApplicationSettingsBase.CopyWorkbookSettingsToStandardSettings()

at Smrf.NodeXL.ExcelTemplate.NodeXLApplicationSettingsBase.get_Item(String propertyName)

at Smrf.NodeXL.ExcelTemplate.GraphMetricUserSettings.get_GraphMetricsToCalculate()

at Smrf.NodeXL.ExcelTemplate.GraphMetricUserSettings.ShouldCalculateGraphMetrics(GraphMetrics graphMetrics)

at Smrf.NodeXL.ExcelTemplate.CalculateGraphMetricsContext.ShouldCalculateGraphMetrics(GraphMetrics graphMetrics)

at Smrf.NodeXL.ExcelTemplate.OverallMetricCalculator2.TryCalculateGraphMetrics(IGraph graph, CalculateGraphMetricsContext calculateGraphMetricsContext, GraphMetricColumn[]& graphMetricColumns)

at Smrf.NodeXL.ExcelTemplate.GraphMetricCalculationManager.CalculateGraphMetricsAsyncInternal(CalculateGraphMetricsAsyncArgs oCalculateGraphMetricsAsyncArgs, BackgroundWorker oBackgroundWorker, DoWorkEventArgs oDoWorkEventArgs)

at Smrf.NodeXL.ExcelTemplate.GraphMetricCalculationManager.BackgroundWorker_DoWork(Object sender, DoWorkEventArgs e)

at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)

at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)


Jan 15, 2014 at 6:27 PM
Edited Jan 15, 2014 at 6:27 PM

It's definitely not supposed to do that, but we have heard from two other people who ran into the same problem:

In the first case, the problem may have been caused by repeated installations and removals of multiple versions of Office, including a preview edition of Office 365. We didn't determine a cause for the second case, although we did establish that Excel itself was corrupted, as opposed to NodeXL.

In your case, we might start by determining whether your copy of Excel has been corrupted. I'll repost the steps for doing that in a post that will follow this one.

-- Tony
Jan 15, 2014 at 6:28 PM
I've attached a test program called TestExcel.exe at Can you please do the following:

1 Download TestExcel.exe to your desktop.

2 Double-click TestExcel.exe on your desktop.

Here is what should happen:

3 The program should open an Excel window.

4 A message should pop up saying "The program worked properly."

Tell me if that actually occurs on your computer.

I've also attached the source code for the program (which is very simple), in case anyone wants to see what it's doing.

Jan 15, 2014 at 8:46 PM
Edited Jan 15, 2014 at 8:47 PM
Hi Tony,

Thanks for pointing me to those other threads - I'm afraid they didn't surface when I searched the discussion threads by the error message contents. I downloaded and ran the TestExcel.exe file and received an error (reproduced below). I understand from the other threads that this means my copy of Excel is somehow corrupt, most likely due to my installing (and uninstalling) the Office 2013 preview version (which I did sometime last year, I think). I will try uninstalling and re-installing Office 2010 to see if that fixes it, but I doubt I can afford the time to reinstall Windows completely (at least not for a little while). Thank you for your help.

A problem occurred. You can press Ctrl-C to copy the details to the Windows Clipboard.

Unable to cast COM object of type 'Microsoft.Office.Interop.Excel.ApplicationClass' to interface type 'Microsoft.Office.Interop.Excel._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208D5-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).

Stack trace
at Microsoft.Office.Interop.Excel.ApplicationClass.set_Visible(Boolean RHS)

at TestExcel.Program.Main(String[] args)


Jan 15, 2014 at 9:11 PM
You can also try to fix this by running the Office "detect and repair" utility, which you can read about at

If you manage to fix it in one way or another, please let me know. It would be nice to have a solution on hand in case others run into the same thing.