I automate the Chart creation via Excel automation and use code like this: ------------------------------------------------------------------ VAR XlApplication: ‘Microsoft Excel 11.0 Object Library’.Application"; XlWorkBook: ‘Microsoft Excel 11.0 Object Library’.Workbook"; XlWorkSheet: ‘Microsoft Excel 11.0 Object Library’.Worksheet"; XlRange: ‘Microsoft Excel 11.0 Object Library’.Range"; XlChart: ‘Microsoft Excel 11.0 Object Library’.Chart"; PROCEDURE CREATE(XlApplication); XlWorkBook := XlApplication.Workbooks.Add(-4167); XlWorkSheet := XlApplication.ActiveSheet; XlWorkSheet.Name := ‘Report’; … // filling data XlRange := XlWorkSheet.Range(‘a1:af10’); XlChart := XlWorkBook.Charts.Add; XlChart.ChartWizard(XlRange,4,4,1,0,1,1,‘Chart’); // XlChart.SeriesCollection(1).XValues := ‘=Report!R2C2:R2C32’; ------------------------------------------------------------------ and I want to define my own labels for X-Axis. On VBA it is wiriiten as XlChart.SeriesCollection(1).XValues = “=Report!R2C2:R2C32” but I got “You have specified an unkknown variable XValues” for that construction How could I write that expression?
What version of Navison are you running? Have you tried using the Excel Buffer Table? (T370) It helps to create the Excel work book with a lot more ease. You could then add a function for the labels. When you say you want to define your own labels in the X-Axis what exactly do you mean? You could create a Macro to do it and use a function that runs the Macro? But then you would need to define a template that contains the macro and save its location within the database and open that workbook everytime! I can’t remeber the exact code to run a macro in a workbook from navision, but I am sure if you search this forum you should see some info on it! cheers Tony
I had similar problems when I created a diagram from C/AL. The following code works for me: xlsSourceRange := xlsWorksheet.Range(xlsCell1, xlsCell2); xlsSeries := xlsChart.SeriesCollection(1); xlsSeries.XValues(xlsSourceRange);
So, the trick is not to assign a value to some - obviously unknown - XValues property, but to call it as a function.