#include c:\reports\others\xl97cons.h >>>#define xltrue -1 >>>#define xlfalse 0 >>> >>>local oexcel, osheet >>>oexcel = createobject("Excel.Application") >>>oexcel.visible = 0 && for debugging >>>oexcel.workbooks.open("c:\exc\test.xls") >>>osheet = oexcel.activesheet >>>nline=2 >>>select t2 >>>scan >>> nline=nline+1 >>> iyear=int(t2.year) >>> icount=int(t2.count) >>> iall=int(t2.all) >>> osheet.cells(nline,2).value =iyear >>> osheet.cells(nline,3).value = icount >>> osheet.cells(nline,4).value = iall >>>endscan >>> >>>oexcel.visible = -1 && for debugging >>> >>>osheet.parent.saved = xltrue >>> >>>>>>Thanks
>>Create Cursor _sample (Year b(2),Count b(2),All b(2)) >>For ix = 1 To 10 >> Insert Into _sample Values ; >> (1997+m.ix,; >> Rand()*1000,; >> Rand()*1000) >>Endfor >> >>Local lcTemp >>lcTemp = Forcepath( Sys(2015)+'.txt',Sys(2023) ) >>Select Int(Year),Int(Count),Int(All) From _sample Into Cursor crsData >>Copy To (m.lcTemp) Type Delimited With Tab >>_Cliptext = "Year"+Chr(9)+"Count"+Chr(9)+"All"+Chr(13)+Filetostr(m.lcTemp) >>Erase (m.lcTemp) >> >>#include xlconstants.h >> >>Local oexcel >>oexcel = Createobject("Excel.Application") >>oexcel.workbooks.Add >>oexcel.Visible = .T. >>With oexcel.ActiveWorkBook.ActiveSheet >> .Range('B2').PasteSpecial >> oRange = .Application.Selection >> With oRange >> oChartRange = .Range(.Cells(0,1), .Cells(.Rows.Count-1, 2)) >> oLabelsRange = .Range(.Cells(1,0), .Cells(.Rows.Count-1, 0)) >> Endwith >> .ChartObjects.Add(200, 10, 300, 300) >> With .ChartObjects(1).Chart >> .SetSourceData(oChartRange, xlColumns) >> .hastitle = .T. >> .haslegend = .T. >> .ChartTitle.Caption = "My Custom Chart Title" >> .ChartType = xlColumnClustered >> .SeriesCollection(1).XValues = oLabelsRange >> Endwith >>Endwith >>If you base your chart on a pivot table then you wouldn't need adjustments on ranges but simply provide new data for your pivot.