Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to save a report to a .xls
Message
De
20/03/2002 06:29:19
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
19/03/2002 23:19:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00634777
Message ID:
00634848
Vues:
21
>Hi all,
>
>I need to generate a report from VFP and save that report to a excel format files. How can I do this?
>
>Linda

Linda,

If you use automation, you have control over every detail.

I will provide a simple sample program, to show you how to get started. The sample program below will open Excel, add a spreadsheet, and place some text in cell A1.

I prefer to refer to cells by row and column numbers - these are easier to manage with a program than references of the "A1" type. Note that the row is specified first.

After that, if you want to do anything else with Excel, record a macro, and do something. Look at the generated code - it can be easily adapted to VFP.

And, of course, feel free to ask back for further details.

Hilmar.
oExcel = CreateObject("Excel.Application")
oExcel.Visible = 1   && for debugging
oExcel.Workbooks.Add()
oSheet = oExcel.ActiveSheet
oSheet.Cells(1,1).Value = "Hello!"
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform