in excel addin i have a form chartdetails :
i try to open this form using ribbon button this way:
in the line below i have exception HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))
i use vs2008 and excel 2007.
any ideas what's wrong (i guess it's something with "qt" variable) ?
Code:
Public Class ChartDetails
Private myChart As Excel.Chart
Private myChartQueryTable As Excel.QueryTable
Public Sub New(ByRef chart As Excel.Chart, ByRef qt As Excel.QueryTable)
InitializeComponent()
myChart = chart
myChartQueryTable = qt
End Sub
....
end classi try to open this form using ribbon button this way:
Code:
Private Sub btnChartDetails_Click(ByVal sender As System.Object, ByVal e As Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs) Handles btnChartDetails.Click
Dim sh As Excel.Worksheet = Globals.ThisAddIn.Application.ActiveSheet
Dim qt As Excel.QueryTable = sh.QueryTables(1)
MsgBox(qt.Name) 'test to ensure query table exists
Dim chd As New ChartDetails(sh.ChartObjects(1).chart, qt) 'this line throws error
chd.Show()
End SubCode:
Dim chd As New ChartDetails(sh.ChartObjects(1).chart, qt) 'this line throws errorany ideas what's wrong (i guess it's something with "qt" variable) ?