I have spent hours and hours trying it get this to work.
searching here and on the Internet.
I have found the same code over and over but it just doesn't work.
Here goes:
Column A in Excel table is Country
Column G is sales for Country by customer (Actually several columns need to be subtotaled. G and H are example here.)
I want to subtotal G and H on Country (column A)
#DEFINE True .T.
#DEFINE False .F.
#DEFINE xlSum -4157
local array subarray(2)
subarray(1) = 7
subarray(2) = 8
oExcel = CREATEOBJECT ("Excel.Application")
WITH oExcel
.Selection.Subtotal(1,xlSum,&subarray,.T.,.F.,T)
ENDWITH
I have tried DIMENSION subarray(2)
I have tried COMARRAY(oExcel,11) (one based array)
If I use:
.Selection.Subtotal(1,xlSum,7,.T.,.F.,T)
it works fine for 7th column or G.
I just can't get an ARRAY to work.
I keep getting the error MISSING OPERAND
If I removed the & before subarray it will subtotal the last number in the array in this case 8
Any help would be appreciated.
John O'D
searching here and on the Internet.
I have found the same code over and over but it just doesn't work.
Here goes:
Column A in Excel table is Country
Column G is sales for Country by customer (Actually several columns need to be subtotaled. G and H are example here.)
I want to subtotal G and H on Country (column A)
#DEFINE True .T.
#DEFINE False .F.
#DEFINE xlSum -4157
local array subarray(2)
subarray(1) = 7
subarray(2) = 8
oExcel = CREATEOBJECT ("Excel.Application")
WITH oExcel
.Selection.Subtotal(1,xlSum,&subarray,.T.,.F.,T)
ENDWITH
I have tried DIMENSION subarray(2)
I have tried COMARRAY(oExcel,11) (one based array)
If I use:
.Selection.Subtotal(1,xlSum,7,.T.,.F.,T)
it works fine for 7th column or G.
I just can't get an ARRAY to work.
I keep getting the error MISSING OPERAND
If I removed the & before subarray it will subtotal the last number in the array in this case 8
Any help would be appreciated.
John O'D