Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Anchoring a chart to a certain area


I can't believe the no one knows how to fix this. I really need som
help. Can anyone please help

--
ena
-----------------------------------------------------------------------
enak's Profile: http://www.excelforum.com/member.php...fo&userid=2865
View this thread: http://www.excelforum.com/showthread.php?threadid=48315

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Anchoring a chart to a certain area

What's your question? There's not much detail in the subject of this post,
and none in the body.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______


"enak" wrote in message
...

I can't believe the no one knows how to fix this. I really need some
help. Can anyone please help?


--
enak
------------------------------------------------------------------------
enak's Profile:
http://www.excelforum.com/member.php...o&userid=28650
View this thread: http://www.excelforum.com/showthread...hreadid=483152



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Anchoring a chart to a certain area


I don't know how much more detail I can provide than what I have already
provided. Please read my first post. I need to be able to put the charts
at certain locations on the spreadsheet.

I have tried to create a macro and then use that code to put in my code
but I get errors when I run it.

How can I put the chart at a certain location (anchore it to a cell) in
the spreadsheet. I am trying to do this through vb.net code in a windows
application.


--
enak
------------------------------------------------------------------------
enak's Profile: http://www.excelforum.com/member.php...o&userid=28650
View this thread: http://www.excelforum.com/showthread...hreadid=483152

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Anchoring a chart to a certain area

When you create the chart, don't use Workbooks("Book1.xls").Charts.Add, use

Workbooks("Book1.xls").Worksheets("Sheet1").ChartO bjects.Add _
(Left, Top, Width, Height)

where Left etc., allow you to specify a precise location and size for the
chart object, in points. To have a chart cover the range "B2:F15", use
something like this:

With Workbooks("Book1.xls").Worksheets("Sheet1").Range( "B2:F15")
Workbooks("Book1.xls").Worksheets("Sheet1").ChartO bjects.Add _
(.Left, .Top, .Width, .Height)
End With

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______


"enak" wrote in message
...

I don't know how much more detail I can provide than what I have already
provided. Please read my first post. I need to be able to put the charts
at certain locations on the spreadsheet.

I have tried to create a macro and then use that code to put in my code
but I get errors when I run it.

How can I put the chart at a certain location (anchore it to a cell) in
the spreadsheet. I am trying to do this through vb.net code in a windows
application.


--
enak
------------------------------------------------------------------------
enak's Profile:
http://www.excelforum.com/member.php...o&userid=28650
View this thread: http://www.excelforum.com/showthread...hreadid=483152





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Anchoring a chart to a certain area


Thanks for the reply. That fixed that problem. I need to be able to
format the chart, i.e. set the x axis, set the legend, put in data
points along the lines of the chart, etc.

Here is what I have so far:

'Anchore the chart to a particular area.
With xlSheet.Range("A" & nChartOffset + 5 & ":E" &
nChartOffset + 15)
xlSheet.ChartObjects.Add(.Left, .Top, .Width,
..Height)
nChartObj += 1
End With

oChartObj = xlSheet.ChartObjects(nChartObj)
oChart = oChartObj.Chart
oChart.ChartType = Excel.XlChartType.xlLine
oChart.SetSourceData(Source:=xlSheet.Range("M" &
nChartOffset + 13 & ":N" & ((nChartOffset) + 13) + i),
Plotby:=Excel.Constants.xlColumn)
'Dim xlsSerie As Excel.SeriesCollection =
oChart.SeriesCollection(1)

oChart.Location(Excel.XlChartLocation.xlLocationAs Object, "Quarterly
Portfolio Review")
oChartObj.Width = 250
oChartObj.Height = 175

Everything that I have tried has given me an error. I have looked
through the chartobject but do not see what I need. How can I do this?

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stacked area and area chart combo [email protected] Charts and Charting in Excel 6 August 18th 06 02:30 PM
Resize plot area in a chart area Darlene Excel Discussion (Misc queries) 0 July 10th 06 02:50 PM
How to increase chart area without affecting plot area? [email protected] Charts and Charting in Excel 2 April 21st 06 09:05 PM
Resize chart area without resizing plot area Janwillem van Dijk Charts and Charting in Excel 2 August 2nd 05 01:52 AM
Resize chart area without resizing plot area Janwillem van Dijk[_2_] Excel Programming 2 August 2nd 05 01:52 AM


All times are GMT +1. The time now is 03:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"