Application.COMAddIns Subscript out of range

送分小仙女□ 提交于 2019-12-13 16:14:55

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/39431469/application-comaddins-subscript-out-of-range

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!