Trying to clarify:
--> Code generated recording my macro:
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = "=Data!R8C1:R32C1"
ActiveChart.SeriesCollection(1).Values = "=Data!R8C2:R32C2"
ActiveChart.SeriesCollection(1).Name = "=Data!R7C2"
* important detail: in the Portuguese version the code generated for the
macro in Excel is the same!!!
--> My code in Dephi 5:
// ....
Excel := CreateOLEObject ('Excel.Application');
//
// ... (generates sheet)
//
Excel.Charts.Add;
Excel.ActiveChart.ChartType := xlColumnClustered
Excel.ActiveChart.ChartType := xlLineMarkers;
//
// ... (create series with SeriesCollection.NewSeries)
//
// The problem is below! This code works only in computers where is
// installed the English version!
//
Excel.ActiveChart.SeriesCollection.Item[1].Name := '=Data!R7C2';
Excel.ActiveChart.SeriesCollection.Item[1].XValues :=
'=Data!R8C1:R32C1';
Excel.ActiveChart.SeriesCollection.Item[1].Values := '=Data!R8C2:R32C2';
--> I does work this way:
Excel.ActiveChart.SeriesCollection.Item[1].Name := 'Name';
Excel.ActiveChart.SeriesCollection.Item[1].XValues :=
VarArrayOf([1,2,3]);
Excel.ActiveChart.SeriesCollection.Item[1].Values :=
VarArrayOf([1,2,3]);
... i.e., it's a problem with the string that defines the range of cells!
Because with constant values, it works in any language!
=-------//-------=
Well... if somebody have some idea... and please could tell me... :)
[]s!
Daniel.
--
Daniel Valim Líberman dan...@ram.com.br
RAM Computer Systems www.ram.com.br
Fudiotes, desencatum.
Vita brevis...
While I don't know why your code doesn't work, have you tried the
alternative way of specifying the xvalues. From XL help:
Charts("Chart1").SeriesCollection(1).XValues = _
Worksheets("Sheet1").Range("B1:B5")
I recorded the creation of a chart and got the same stuff you got, i.e.,
ActiveChart.SeriesCollection(1).XValues = "=Sheet1!R4C1:R6C1"
ActiveChart.SeriesCollection(1).Values = "=Sheet1!R4C2:R6C2"
ActiveChart.SeriesCollection(1).Name = "=Sheet1!R3C2"
Then, I tried
ActiveChart.SeriesCollection(1).XValues = ActiveSheet.Range("A4:A6")
ActiveChart.SeriesCollection(1).Values = ActiveSheet.Range("b4:b6")
ActiveChart.SeriesCollection(1).Name = ActiveSheet.Range("B3")
and got the same result.
You might want to try it.
--
Regards,
Tushar Mehta
www.tushar-mehta.com
MVP MS Excel
--
In <OpPZoPViBHA.2212@tkmsftngp03>, Daniel Líberman <dan...@ram.com.br>
wrote