*** create an instance of excel. loXl = CREATEOBJECT( 'Excel.Application' ) *** Now add a workbook so we can populate the active worksheet *** with the data from the query results loWB = loXl.Workbooks.Add() *** Now fill in the data WITH loWb.ActiveSheet *** Give it a name so we can reference it *** after we add a new sheet for the chart .Name = "ChartData" *** Get the number of field in eachs record lnFldCount = FCOUNT( 'csrResults' ) *** Add one because copying the data to the clipboard *** adds a row for the field names lnRecCnt = RECCOUNT( 'csrResults' ) + 1 SELECT csrResults GO TOP *** Copy to clipboard with fields delimited by tabs _VFP.DataToClip( 'csrResults', RECCOUNT( 'csrResults' ), 3 ) *** Get the range of the data in the worksheet lcCell = 'A1:' + CHR( 64 + lnFldCount ) + TRANSFORM( lnRecCnt ) *** And paste it in .Paste( .Range( lcCell ) ) *** But now we have to make sure that cell A1 is blank *** Otherwise the chart is not created correctly .Range( "A1" ).Value = "" GO TOP IN csrResults ENDWITH loChart = loWB.Charts.Add()