Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to add Subtotal and Groupby ?
Message
 
À
08/07/2011 23:14:48
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2008
Divers
Thread ID:
01517672
Message ID:
01517841
Vues:
58
>Hi,
>
>I try this, but not success,
>please advise.
>
>
>dimension atemp[1]
>atemp[1]=4
>oExcel.activesheet.Selection.Subtotal(1,xlSum, @atemp,.t.,.f.,.t.)
>
>
>
>Thanks.

This works for me:
#define xlSum -4157

LOCAL oExcel AS Excel.Application
oExcel = CREATEOBJECT([Excel.Application])
oExcel.Visible= .t.
oExcel.DisplayAlerts = .f.
oExcel.Workbooks.Add()
oExcel.ActiveCell.FormulaR1C1 = "_1_"
oExcel.Range("A2").Select
oExcel.ActiveCell.FormulaR1C1 = "_1_"
oExcel.Range("A3").Select
oExcel.ActiveCell.FormulaR1C1 = "_2_"
oExcel.Range("A4").Select
oExcel.ActiveCell.FormulaR1C1 = "_2_"

oExcel.Range("B1").Select
oExcel.ActiveCell.FormulaR1C1 = "1"
oExcel.Range("B2").Select
oExcel.ActiveCell.FormulaR1C1 = "2"

oExcel.Range("B3").Select
oExcel.ActiveCell.FormulaR1C1 = "5"
oExcel.Range("B4").Select
oExcel.ActiveCell.FormulaR1C1 = "6"

dimension atemp[1]
atemp[1]=2

oExcel.Selection.Subtotal(1, xlSum, @atemp,.t., .f., .t.)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform