Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Borislav Borissov
  Where is Borislav Borissov?
 Sofia
 Bulgaria
 Borislav Borissov
 To: Anders Wennerwik
  Where is Anders Wennerwik?
 Ross-on-Wye
 United Kingdom
 Anders Wennerwik
Subject: RE: Excel Chart automation
Thread ID: 179995 Message ID: 180009 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Microsoft Office Automation
Date: Tuesday, June 24, 2008 6:36:41 PM         
   



> oExcel = CREATEOBJECT("Excel.Application")
> oExcel.oWorkBook = .workbooks.add
> oExcel.oSheet = oWorkbook.worksheets(1)
>
> oRange = oSheet.range("B1:E1,B4:E4")
> oChartSheet = oExcel.sheets(2)
> oChart = oExcel.charts.add
> oChart.charttype =70
> oChartSheet.activate
> oChart.SetSourceData(oRange, 2)
> ochart.ApplyDataLabels(5, .f., .f., .f.)
> oChart.location(2, oChartSheet.name)
> .Visible = .T.
That works for me:

LOCAL oExcel AS Excel.Application
oExcel           = CREATEOBJECT("Excel.Application")
oExcel.Visible   = .T.
oWorkBook        = oExcel.Workbooks.Add()  && oWorkBook not oExcel.oWorkBook
oSheet           = oWorkbook.worksheets(1) && oSheet    not oExcel.oSheet

oRange           = oSheet.range("B1:E1;B4:E4") && With semi-colon, not with comma, but i suspect that depends of regional settings of the computer
oChartSheet      = oExcel.sheets(2)
oChart           = oExcel.charts.add
oChart.charttype = 70
oChartSheet.activate()

oChart.SetSourceData(oRange, 2)
ochart.ApplyDataLabels(5, .f., .f., .f.)
oChart.location(2, oChartSheet.name)

Unfortunately I have no Office 97 to test this.



-----------------
Borislav Borissov

Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.

ENTIRE THREAD

Excel Chart automation Posted by Anders Wennerwik @ 6/24/2008 6:02:12 PM
RE: Excel Chart automation Posted by Borislav Borissov @ 6/24/2008 6:11:02 PM
RE: Excel Chart automation Posted by Anders Wennerwik @ 6/24/2008 6:15:58 PM
RE: Excel Chart automation Posted by Borislav Borissov @ 6/24/2008 6:36:41 PM
RE: Excel Chart automation Posted by Yuri Rubinov @ 6/24/2008 9:05:08 PM