Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Anchoring a chart to a certain area
I have an application that I use WinForms.net and VB.NET as the frontend, MS Access 2000 as the backend. I use Excel to create reports. On the biggest report I I have tables and charts. I create the charts in the spreadsheet as an object. However, when the chart is created it is not put where I would like to be. I have tried to select a cell prior to creating the chart but this only puts it in the general area. Here is the code that I use to create the chart: xlSheet.Cells(((nChartOffset) + 9) + i, 1).Select() 'this puts the chart in the general area 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" & (nChartOffset) + 13 & ":N" & ((nChartOffset) + 13) + i), Plotby:=Excel.Constants.xlColumn) oChart.Location(Excel.XlChartLocation.xlLocationAs Object, "Quarterly Portfolio Review") '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" How can I accomplish this? BTW, all of the code that is commented out causes an error. I get an error on the first commented line above that states: "Exception from HRESULT: 0x800401A8." Each of the commented lines cause the same error. I don't know what this error means. I can not find anything that helps on the internet. Thanks, enak -- enak ------------------------------------------------------------------------ enak's Profile: http://www.excelforum.com/member.php...o&userid=28650 View this thread: http://www.excelforum.com/showthread...hreadid=483152 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Stacked area and area chart combo | Charts and Charting in Excel | |||
Resize plot area in a chart area | Excel Discussion (Misc queries) | |||
How to increase chart area without affecting plot area? | Charts and Charting in Excel | |||
Resize chart area without resizing plot area | Charts and Charting in Excel | |||
Resize chart area without resizing plot area | Excel Programming |