Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP6 to Excel
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Divers
Thread ID:
00391588
Message ID:
00391914
Vues:
9
Try this:

Create an Excel File that formatted to your liking. For instance,
make columns A, D and F currency formatted, columns B, C and E percentage.
Add your titles and column headings. Be sure to place the cursor in cell
A1 and then save the Excel File.

Now open the existing Excel file using VFP

oExcel = CREATEOBJECT('Excel.Application')
oExcel.WorkBooks.Open('ExcelTemplateFile')

SELECT the cursor that will be used to populate the Excel file and issue GO TOP. The next step will be to take the contents of the cursor and place it into the Windows clipboard as tab delimited. That is accomplished via the following syntax:

Application.DataToClip('cursorname',RECCOUNT('cursorname'), 3)

SELECT the cell to start the paste and then issue

oExcel.ActiveSheet.Paste()
oExcel.ActiveWorkBook.SaveAs('DirectoryAndFileNameOfSavedFile')
oExcel.Quit()

When complete, issue a SAVE AS and you have a quick reusable routine
to produce an Excel report...


>Hi Todd,
>
>What I've done in the past is to use the COPY TO ... TYPE XL5 command to create a sheet, then create another sheet that pulls the values from the VFP generated sheet and put it into a presentable format.
>
>HTH,
>
>--Ken
>
>>We are starting to directly write file to Excel using a variety of VBA commands that also work in VFP. Unfortunatly, The only way we have found to change the value of a cell is by Value property of a cell. This is ok if the data we are trying ot send to Excel is a small range but when there are 40 columns and 200 rows of data, changing the value of 8000 cells can take some time. Is there a way to "drop" an array into a range of cells instead of chaning the values one by one?
>>
>>My programming partner and myself are a couple of self-taught programmers and appreciate any help offered.
>>
>>Todd Cottengim
>>Alpine Land Information Services
>>tcottengim@alpine-lis.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform