Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.charting
|
|||
|
|||
Creating chart from vb.net
Hello,
i want to add a chart to a Excel-Sheet with vb.net. (VS 2005). This is possible, but on setting the HasTitle property i get an exception: "Exception from HRESULT: 0x800A03EC". If anybody could help me I would be very thankfull. I have installed Microsoft Excel 2003 (11.8105.8107) SP2. I added a reference to the "Microsoft Excel 11.0 Object Library", Version 1.5 from the COM tab. This creates following references to my project: -Excel, Name: Microsoft.Office.Interop.Excel, Version: 1.5.0.0 (Description: Microsoft Excel 11.0 Object Library) - Microsoft.Office.Core, Name: Office, Version: 2.3.0.0 (Description: Microsoft Office 11.0 Object Library) Here is the code to reproduce the probleme: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ExcelApp As New Microsoft.Office.Interop.Excel.Application Dim MyWorkbook As Microsoft.Office.Interop.Excel.Workbook Dim MyChart As Microsoft.Office.Interop.Excel.ChartObject Dim ChartSheet As Microsoft.Office.Interop.Excel.Worksheet Try ExcelApp.Visible = True MyWorkbook = ExcelApp.Workbooks.Open("C:\MyWorkbook.xls") ChartSheet = MyWorkbook.Sheets(1) MyChart = ChartSheet.ChartObjects.Add(Left:=50, Width:=800, Top:=50, Height:=500) MyChart.Chart.ChartType = XlChartType.xl3DBarClustered MyChart.Chart.HasTitle = True 'this line causes the error Catch ex As Exception System.Windows.Forms.MessageBox.Show(ex.Message) End Try End Sub Thank you in advance for your help Reinhard |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
NEED HELP CREATING A CHART | Charts and Charting in Excel | |||
Creating a Pie Chart | Charts and Charting in Excel | |||
Creating a Chart | Excel Discussion (Misc queries) | |||
creating a pie chart | Charts and Charting in Excel | |||
creating a chart | Charts and Charting in Excel |