I am trying to put some Excel charts into a spreadsheet but am having problems with any type of formatting.
Here is my code:
Dim oChart As Excel.Chart
Dim xlsAxisCategory, xlsAxisValue As Excel.Axes
oChart = xlSheet.Application.Charts.Add
Dim xlsSerie As Excel.SeriesCollection = oChart.SeriesCollection
oChart.ChartType = Excel.XlChartType.xlLine
oChart.SetSourceData(Source:=xlSheet.Range("M" & (nrow * 26) + 13 & ":N" & ((nrow * 26) + 13) + i), Plotby:=Excel.Constants.xlColumn)
oChart.Location(Excel.XlChartLocation.xlLocationAsObject, "Quarterly Portfolio Report")
'oChart.ChartArea.Height = 150
'oChart.ChartArea.Width = 300
'oChart.HasTitle = True
'oChart.ChartTitle.Text = "ASSET GROWTH SINCE INCEPTION"
'oChart.ChartTitle.Font.FontStyle = "Bold"
'oChart.ChartTitle.Font.Size = 9.75
'oChart.SeriesCollection = xlSheet.Range("M" & (nrow * 26) + 13 & ":M" & ((nrow * 26) + 13) + i))
'xlsSerie.Item(1).Name = "Market Value"
'xlsSerie.Item(2).Name = "Net Cash Flow"
I can create the chart fine but any time I try to use the code that has been commented out, I get an error "Exception from HRESULT: 0x800A01A8."
I am not sure what this error means and I definitely don't know how to fix it.
Any and all help would be appreciated.
Thanks,
enak
Here is my code:
Dim oChart As Excel.Chart
Dim xlsAxisCategory, xlsAxisValue As Excel.Axes
oChart = xlSheet.Application.Charts.Add
Dim xlsSerie As Excel.SeriesCollection = oChart.SeriesCollection
oChart.ChartType = Excel.XlChartType.xlLine
oChart.SetSourceData(Source:=xlSheet.Range("M" & (nrow * 26) + 13 & ":N" & ((nrow * 26) + 13) + i), Plotby:=Excel.Constants.xlColumn)
oChart.Location(Excel.XlChartLocation.xlLocationAsObject, "Quarterly Portfolio Report")
'oChart.ChartArea.Height = 150
'oChart.ChartArea.Width = 300
'oChart.HasTitle = True
'oChart.ChartTitle.Text = "ASSET GROWTH SINCE INCEPTION"
'oChart.ChartTitle.Font.FontStyle = "Bold"
'oChart.ChartTitle.Font.Size = 9.75
'oChart.SeriesCollection = xlSheet.Range("M" & (nrow * 26) + 13 & ":M" & ((nrow * 26) + 13) + i))
'xlsSerie.Item(1).Name = "Market Value"
'xlsSerie.Item(2).Name = "Net Cash Flow"
I can create the chart fine but any time I try to use the code that has been commented out, I get an error "Exception from HRESULT: 0x800A01A8."
I am not sure what this error means and I definitely don't know how to fix it.
Any and all help would be appreciated.
Thanks,
enak