I have successfully automated transactions between Excel and VFP, such as reading cells from Excel and writing back new data to other cells. Try something like this, although this particular code snippet is not tested:
oExcel = CREATEOBJECT('excel.application')
oExcel.Workbooks.Open("[FILENAME]")
oExcel.Visible = .T.
FOR lnRow = 1 TO [LAST ROW]
lcCell = 'A' + LTRIM(STR(lnRow))
oExcel.Range('&lcCell.').Select
lcSSN = oExcel.ActiveCell.FormulaR1C1
[Look up Earnings]
oExcel.Cells(lnRow, 2) = lnEarnings
ENDFOR
This will start Excel as a data server and open a spreadsheet. It starts at the the first row in a column and reads in the SSN. Then, use VFP to look up the earnings. Next, it will send the earnings to the column immediately to the right of the SSN. Then, it will go on to the next row.
After running this, you will need to save the file to where you want and then release the oExcel object, to close the connection.
Good Luck!!
Michael Reynolds
>I have a large, very wide spreadsheet in ecxel that has employee social security number in one column and one blank column for earnings figures. The spreadsheet cannot easily be exported to a table because of its complexity.
>
>
>I have a VFP table with the ss# and the earnings figures. Is there some way to have vfp access the spreadsheet, locate the ss# and write the earnings in the adjacent column? I cant fathom having to do this by hand.
>
>
>TIA
>Chris