LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Chart location method fails using sheet name

mystery solved!

Dim objSheet As Object
Dim objChart As Object

For p = LBound(sn) To UBound(sn) 'array of sheet names
Set objSheet = xlapp.Workbooks(strXlsFile).Worksheets(sn(p))
Set objChart = objSheet.ChartObjects.Add(300, 20, 500, 300).Chart
objChart.SetSourceData Source:=xlapp.Workbooks(strXlsFile). _
Worksheets(sn(p)).Range("A1:C" & xlapp.Workbooks _
(strXlsFile).Worksheets(sn(p)).Range("C1").End(xlD own).Row), _
PlotBy:=xlColumns
objChart.ChartType = xlLineMarkersStacked
objChart.Axes(xlCategory, xlPrimary).HasTitle = False
objChart.Axes(xlValue, xlPrimary).HasTitle = False
objChart.HasLegend = False
objChart.ChartTitle.Text = sn(p)
objChart.HasTitle = True
Next p

The ChartObjects collection holds embedded Chart objects, which are accessed
through the ChartObject object; the Chart property of the ChartObject object
is used to access the actual chart. When using automation, the Add method
of the ChartObjects object will add an embedded chart, rather than the Add
method of the Charts object. There's an example he
http://msdn.microsoft.com/library/de...latecharts.asp but it's not very well documented.


 
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
Hyperlink or Other Method To Return To Previous Location (Sheet) Possible? Mhz New Users to Excel 4 August 1st 06 11:39 AM
Workbooks.open method fails JAT Excel Programming 3 January 24th 05 08:19 PM
Excel 2003 Workbooks.Open with CorruptLoad=xlRepairFile fails on Excel 5.0/95 file due to Chart, with Error 1004 Method 'Open' of object 'Workbooks' failed Frank Jones Excel Programming 2 June 15th 04 03:21 AM
Select method of Range fails J West Excel Programming 1 June 7th 04 02:41 PM
Copy method fails in IIS Domien Excel Programming 0 February 19th 04 02:46 PM


All times are GMT +1. The time now is 06:32 PM.

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

About Us

"It's about Microsoft Excel"