LS: Generate Excel Graph

Hi,

i read a lot of news in this and the 4/5 forum. I loaded some code from the sandbox.

But still i got no clue.

I want to open an Excel sheet with one data sheet and another one with the graph.

I want to add a new value and to update the chart. Then i want to export the chart as an gif picture. As i set the new data with SetSourceData, i loose the legend of the chart.

I get lost with the Excel VB help, as sometimes the code does not work in LS. Sorry for the code, but i copied a lot from the examples i got:

Dim excel As Variant

Set excel = CreateObject (“Excel.application”)

excel.visible = True

Set Workbook = Excel.Workbooks.Open(“Some Pathname”)

excel.sheets(“data”).Select

’ Now i fill in the new data (snipped)

Dim excelSheet As Variant

Set excelSheet = excel.ActiveSheet

Dim tchart As Variant

Set tchart = Workbook.Worksheets(“chart”).ChartObjects(1).Chart

tchart.SetSourceData(excelSheet.Range(“B4:B35”))

’ And now i want to set the legend with the

’ VB code that does not work

tchart.SeriesCollection(1).XValues = excelSheet.Range(“A4:A35”)

Call Workbook.Worksheets(“Realzins Plus”).ChartObjects(1).Chart.Export(“C:” + "" + Cstr(1) + “.gif”, “GIF”)

I would need some LS to VB class description.

Another questions: Any code snipplet for transforming a notes date (26.Apr.05) to the Excel date 38468.

Or to change the size of the chart area. .Width and .Heigth seems to be read only?

Thanks in advance,

Markus Ströbel