Automate Microsoft Word and Excel Sample
File: ...\Samples\Solution\OLE\Oleaut1.scx
This is a simple sample showing Visual FoxPro as an Automation controller. It demonstrates how to select data from a Visual FoxPro database, place the data in a Microsoft Excel worksheet, graph the data using Chart, and then display the graph in Word. To use this sample, you need at least Excel 5.0, Word 6.0, and Testdata.dbc, located in the ...\Samples\Data directory.
The following line of code creates a reference to a Microsoft Excel spreadsheet.
objXLsheet=createobject("Excel.Sheet")
The following line of code adds a chart to the spreadsheet.
objChart1 = objXLsheet.ChartObjects.Add(100, 100, 200, 200)
The following line of code creates a reference to Microsoft Word.
objWDdoc=createobject("word.basic")
oWordRef = GetObject('','word.basic')
See Also
Tasks
Automate a Microsoft Word Document in a Form Sample
Automate a Microsoft Excel Spreadsheet Sample