Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Working with Excel Charts

Status
Not open for further replies.

enak

Programmer
Jul 2, 2002
412
US
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
 
I am sure that someone knows something about this. Any help, Please!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top