Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Importing/Exporting From/To Excel 97
Message
 
À
21/06/2000 23:18:11
Tom Gahagan
Alliance Computer Solutions
Thomaston, Georgie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00383017
Message ID:
00383167
Vues:
24
If the copy to ... type XL5 doesn't quite do what you want, you can always open a copy of excel through automation and pretty it up there. It is really pretty easy. I have been using this method instead of reports to avoid multiple sorts and groupings and... lately.

This example will open a table, convert it to EXCEL, make the columns fit correctly leave it open for the user to see. You can easily make other modifications like adding pivot sheets or anything else that EXCEL can do by doing it once in EXCEL with the macro recorder on and then viewing the generated code in the VB Macro editor.

*-- Code Begins Here
select 0
USE somedbf
*Get a temp filename
local lcFName
lcFName = sys(2023)+'\T'+SUBSTR(SYS(2015), 3, 7) +'.dbf'
copy to lcFName type xl5
local loEXCEL,lcExError
lcExError = ON('Error')
ON ERROR =MessageBox('Could Not Open Excel.'+chr(13)+'Please Open File: '+ALLT(lcFName)+' Manually')
loEXCEL = CREATEO('EXCEL.Application')
if VARTYPE(loEXCEL) = 'O'
=loEXCEL.WorkBooks.Open(lcFName)
loEXCEL.Cells.Select
loEXCEL.Selection.Columns.AutoFit
loEXCEL.visible = .t.
endif
if !EMPTY(lcExError)
ON ERROR &lcExError
else
ON ERROR
endif

rele loEXCEL
use in somedbf
*-- Code Ends Here

Bill
>Antonio......
>
>Interactivaly you can use the wizard to import and export or in a program you can use the append from (to import) and copy to (to export) commands.
>
>Hope this helps!
>
>Tom Gahagan
>REST
Bill Mittenzwey
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform