Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to add Subtotal and Groupby ?
Message
 
To
08/07/2011 23:14:48
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2008
Miscellaneous
Thread ID:
01517672
Message ID:
01517841
Views:
56
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform