Value does not fall within the expected range in excel word addin HResult 2147024809

这个错误“Value does notfall within the expected range ”在网上有很多种解释,但是都不能解决我遇到的问题。google能搜到一些具体的解决办法,但是由于国内代理的问题不能访问。当我想往一个Excel里加入一个CuntomTaskPane的时候(Globals.ThisAddIn.CustomTaskPanes.Add(control, titlewindow);就会出现上诉问题,但是此方法在word里加入一个CustomTaskPane的时候是OK的。因为在word里可以很明确的找到window, 通过Globals.ThisAddIn.Application.ActiveDocument.ActiveWindow。但是在Excel中确不容易。既然这样就直接越过这个参数。直接用2个参数的方法就能添加成功。

posted @ 2013-03-25 18:25  javawebsoa  Views(252)  Comments(0Edit  收藏  举报