Hi,
I have a problem with Excel Line Graph. I want to export data from Navision to Excel and I want to create a Line Graph.
I have exported data in a sheet called DataSheet, and my DataSheet is like this:
Cell A1 has value 34
Cell A2 has value 23
Cell A3 has value 25
Cell A4 has value 28
Cell A5 has value 27
…
(My sheet might have a lot of values)
Now I want to create Line Graph using those values.
I see in my Microsoft Excel:
Macro --> VisualBasicEditor --> F2 (so I can see object list), then I select “XlCharttype” Class in the left column, and I see that XlLine graph has code 4 in the right column.
So I write my code as follows (I want to create Line Graph in a new sheet):
‘NumberOfData’ is a text variable; its value is the number of data in my graph (in example above, it has value 5 because I have five values (from A1 to A5)).
CREATE(Excel);
Excel.Visible(TRUE);
Book := Excel.Workbooks.Add(-4167);
DataSheet := Excel.Sheets.Add;
DataSheet.Name := 'MyData';
[…]
[I export my data]
[…]
DataSheet := Excel.ActiveSheet;
Range := DataSheet.Range('A1:A'+NumberOfData);
Chart := Excel.Charts.Add;
Chart.Name := 'LineGraph';
Chart.ChartType := 4;
Chart.SetSourceData(Range,2);
…. ????
Could you help me,please?
I know there is another command called ChartWizard; I tried to use it:
DataSheet := Excel.ActiveSheet;
Range := DataSheet.Range('A1:A'+NumberOfData);
Chart := Excel.Charts.Add;
Chart.ChartWizard(Range, 4, ?, ?, ?, ?, ?, ‘My Line Graph’);
I think that’s a different way to solve my problem, but I don’t know what I have to write in place of ‘?’.
Thank you
0
Comments
Some documentation and usage that could be usefull to you:
http://www.support.microsoft.com/kb/178783/en-us/
http://msdn.microsoft.com/library/defau ... 076799.asp
http://msdn2.microsoft.com/en-us/librar ... izard.aspx
http://msdn2.microsoft.com/en-us/librar ... izard.aspx
Happy New Year...
Arhontis
https://forum.mibuso.com/search