Create Line Graph in Excel from Navision

Marco778
Member Posts: 2
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
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
-
Hello,
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...0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions