Following the sample case below
https://msdn.microsoft.com/en-us/library/bb608614.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1
Run into a 'Subscript out of range' in
Set addIn = Application.COMAddIns("ExcelImportData")
New to VSTO and C#. How do I debug this?
If the add-in subscript is out of Range, it suggests that you've either made a typo in the name of the add-in while creating the VSTO project, or you've failed to open Excel using the debugger (which automatically loads the add-in).
You can ensure that Excel is loading properly by adjusting the Project Properties in Visual studio:
Above, my full path to Excel is:
C:\Program Files (x86)\Microsoft Office\root\Office16\Excel.exe
Then, once you've pressed F5 to start Excel, you can check the loaded COM add-ins by clicking on the COM add-ins button on the Developer tab.