The problem is getting poudy big. I tried to populate the sheet one by one. I still didn't apply the format. The problem is that I have about 10 fields and more then 2000 rows. It's slow!!!!I
would be. If your data to populate generate the graph is in a cursor, just use _VFP.DataToClip() to copy it to the clipboard and let Excel sort it out like this:
loXl = CREATEOBJECT( 'Excel.Application' )
loWB = loXl.Workbooks.Add()
WITH loWb.ActiveSheet
.Name = "ChartData"
lnFldCount = FCOUNT( 'csrResults' )
lnRecCnt = RECCOUNT( 'csrResults' ) + 1
SELECT csrResults
GO TOP
_VFP.DataToClip( 'csrResults', RECCOUNT( 'csrResults' ), 3 )
lcCell = 'A1:' + CHR( 64 + lnFldCount ) + TRANSFORM( lnRecCnt )
.Paste( .Range( lcCell ) )
.Range( "A1" ).Value = ""
GO TOP IN csrResults
ENDWITH
loChart = loWB.Charts.Add()