Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HIde Excel Pivot Table Total Row
Message
From
05/10/2016 06:41:47
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
HIde Excel Pivot Table Total Row
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
SAMBA Server
Database:
MySQL
Application:
Desktop
Miscellaneous
Thread ID:
01641632
Message ID:
01641632
Views:
90
Dear All,

I need to hide the Grand Total row of the excel pivot table. I try the following code but it cant work. kindly advise. Thanks

oExcel = CREATEOBJECT("excel.application")
oExcel.application.Visible = .T.

oWorkBook = oExcel.workBooks.add()

oTargetSheet = oWorkBook.sheets.add()
oTargetSheet.Cells(1,1) = "Production Report by Machine"
mRow = 1
mRange = "A"+TRANSFORM(mRow+2)
oTargetRange = oTargetSheet.range(mRange)

oPivotCache = oWorkBook.pivotCaches.add(2) && External data

oPivotCache.connection = "OLEDB;Provider=vfpOleDb.1;data source = c:\erp\exports"
oPivotCache.commandText = "SELECT * FROM tMcQty"

oPivotTable = oPivotCache.createPivotTable(oTargetRange,"pivotTable")

oPivotTable.PivotFields("cType").orientation = 1&& row
oPivotTable.PivotFields("mc").orientation = 2 && column
oPivotTable.PivotFields("qty").orientation = 4 && data


For Each pvtFld In oPivotTable.PivotFields
pvtFld.Subtotals(1) = .T.
pvtFld.SubTotals(1) = .F.
Next pvtFld
oPivotTable.ManualUpdate = .F.
Reply
Map
View

Click here to load this message in the networking platform