Information générale
Titre:
HIde Excel Pivot Table Total Row
Versions des environnements
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.
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement