Hi everybody,
I'm trying to insert a pie chart into excel worksheet. For this sake I recorded a macro and used its code in Code Stage in the Excel VBO. Here's what my code looks like after the modifications for use in BP:
Here -4102 is a value for xl3DPie from XlChartType enum. After running the action in the process I'm getting an error "Type conflict. Error type HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH)". Research in internet didn't bring me very far in understanding the cause.
Funny thing is, the code actually works and inserts the pie chart into worksheet. I could just catch an error and resume to saving and closing the workbook, but would like to know whether there is a way to get rid of it all together?
I'm trying to insert a pie chart into excel worksheet. For this sake I recorded a macro and used its code in Code Stage in the Excel VBO. Here's what my code looks like after the modifications for use in BP:
Code:
Dim wb as Object = GetWorkbook(handle, workbookname)
Dim ws as Object = GetWorksheet(handle, workbookname, worksheetname)
ws.Activate()
ws.Shapes.AddChart2(262, -4102).Select
wb.ActiveChart.SetSourceData(worksheetname+"!"+sourceStart+":"+sourceEnd)
Here -4102 is a value for xl3DPie from XlChartType enum. After running the action in the process I'm getting an error "Type conflict. Error type HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH)". Research in internet didn't bring me very far in understanding the cause.
Funny thing is, the code actually works and inserts the pie chart into worksheet. I could just catch an error and resume to saving and closing the workbook, but would like to know whether there is a way to get rid of it all together?