Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Spreadsheet update
Message
 
À
14/01/2000 11:42:05
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00317983
Message ID:
00318196
Vues:
30
Good point about VISIBLE, however, I included the comment '&& to see the show', in case he wants to see how it runs. I have put this option in my programs before, to let people sit back and watch a completely formatted spreadsheet get built from scratch, including font sizes, colors, shading, calculations, and whatever else is needed.

Michael


>Good solution Michael :) To speed up things you might set visible = .t. at the end of process (otherwise it's really slow like a fast typist is filling them). Another speedy way is to select range("A:A"), copy to clipboard or file, read and process from VFP, copy column B to clipboard and paste into range("B:B").
>Cetin

>
>>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.  && to see the show.
>>
>>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform