Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy Data from VFP to a worksheet in an EXCEL workbook 1

Status
Not open for further replies.

DHart

Programmer
Oct 29, 2001
11
US
Background Info:
The program extracts data from a database for reporting on several criteria. The tables are then copied to EXCEL files. I have an EXCEL workbook that contains graphs with links to these created worksheets. Since the files with the data need to be opened before the graph workbook, I am using a run command that opens these newly created files. Still I am having an occasional problem with users breaking the links.
My Question:
Is it possible to update/add these newly created files to the workbook as a worksheet that I will link to the graphs? I am using VFP8.0.

I will appreciate any help on this.
Darlene
 
Hi Darlene,

I have an existing Excel Workbook with two worksheets: "Chart" and "ChartData".
Chart contains the chart itself. It refereneces the data in ChartData.
My code to get there is:

oXL = CREATEOBJECT("Excel.Application")
oXL.Visible = .F.
oXL.Workbooks.OPEN("C:\Daily\ItemCompare.XLS")
oXL.Sheets("ChartData").Select
FOR i=1 TO 25
rownum = i
oXL.Cells(rowNum,2).Value = 0
ENDFOR
...
This takes me to the ChartData then zeros out exisitng data in a range in ChartData before populating it.



Bill Chambers
Chambers & Associates
 
You are likely to get more answers in the topic-specific forum
Microsoft: VFP - Automation, Mail & 3rd Party Svcs Forum
Forum1251

It deals with things like VFP Automation of Excel (and Word, etc.) as well as interfacing with other 3rd party objects.

Good Luck,
JRB-Bldr

 
Thanks!!!
Thanks,Bill - Your code got me started on the right track!
Thanks, JRB-Bldr - I found information that I have used to enhance the flexibility and correct an error.

I feel that I am a better programmer because of your willingness to help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top