General information
Title:
HIde Excel Pivot Table Total Row
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only