Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to set grouping in a worksheet
Message
 
 
To
26/10/2010 07:31:32
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01486712
Message ID:
01486972
Views:
43
The Excel methods can accept either named or positional parameters. VFP can only pass positional parameters. The correct order of positional parameters is provided in Excel VBA/VB help
.Subtotal(GroupBy, Function, TotalList, Replace, PageBreaks, SummaryBelowData)

Parameters

GroupBy - The field to group by, as a one-based integer offset. For more information, see the example. 
Function - XlConsolidationFunction . The subtotal function. 
TotalList - An array of 1-based field offsets, indicating the fields to which the subtotals are added. 
Replace - True to replace existing subtotals. The default value is True. 
PageBreaks - True to add page breaks after each group. The default value is False. 
SummaryBelowData - XlSummaryRow . Places the summary data relative to the subtotal. 

#DEFINE xlSum -4157
DIMENSION laCols[1]
laCols[1] = 3
oRange.Subtotal(2, xlSum, @laCols, .T., .F., .T.)
>
>The Excel commands usually come in two versions, one with "named parameters" which are not understood by Visual FoxPro, and one where the parameters are by position (as in Visual FoxPro). The parameters by position are usually in the same order as the saved macro, but I believe there is no guarantee for this; you had better check the VBA help for the Subtotal() function. If it is in the same order, it would be something like this:
>
>
>oRange = oSheet.Range(oSheet.Cells(1, 1), oSheet.Cells(14, 3))
>oRange.Subtotal(2, xlSum, Array(3), .T., .F., .T.)
>
>
>This would be the approximate syntax, but unfortunately I don't know what array(3) refers to in this case, and how to convert it.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform