o_xlsheet.Sheets("Chart1").Select o_xlsheet.ActiveChart. && Instead of o_xlsheet.Chartobjects(1).chart.there wouldn't be any error. Funny terminology is somewhat different (to me maybe) between VB and VFP. Chartobject is a container for embedded charts (Excel doesn't threat chart on a separate sheet as embedded ? Instead of chartobjects container, "chart1" sheet is the container itself - makes sense). Referring to it can be via , selection + activechart or charts(nIndex) ( instead of chartobjects(nIndex).chart - chartobject has border and interior props in addition to chart ref prop). Now add these lines to previous sample code before "=sys(3006,val(nlLocaleId))
with ox.charts(1) && This is our chart created on a separate sheet .walls.Interior.ColorIndex = -4142 &&good line .SeriesCollection(2).border.ColorIndex = 17 .SeriesCollection(2).Interior.ColorIndex = -4142 endwith with ox.Sheets("Sheet1") .Select .chartobjects.Add(100, 100, 200, 200) && Embedded chart on sheet1 with .chartobjects(1).chart .chartwizard(ox.sheets("Sheet1").range("A1:D3"),; -4099,5,2,0,1,1,"","","","") && Easy range :) .plotby = 2 .walls.Interior.ColorIndex = -4142 &&good line with .SeriesCollection(1) .border.ColorIndex = 17 .Interior.ColorIndex = -4142 endwith endwith endwithCetin