Skip to main content

Update-the-Pivot-Chart

Command Description

Update all pivot charts of the designated worksheet

Command Prototype

Excel.RefreshPivotTables(objExcelWorkBook,sheet)

Parameter Description

ParameterRequiredTypeDefaultDescription
objExcelWorkBookTrueexpressionobjExcelWorkBookExcel workbook object (workbook opened with "Open Excel" command (Excel.OpenExcel) or the workbook object returned by the command "Bind Excel" (Excel.BindBook))
sheetTruestring"Sheet1"The string means sheet name. The number means sheet order(starting from 0)

Demo

/************************Insert row ************************ ******** 
**Input 1:
** objExcelWorkBook--Excel workbook object (a workbook opened using the "Open Excel" command (Excel.OpenExcel) or a job bound using the "Bind Excel" command (Excel.BindBook) book object).
**Entry 2:
** sheet--If a string is used, it means the name of the specified worksheet; if a number is used, it means the order of the specified worksheet (starting from 0).
*********************************************************************/

objExcelWorkBook = Excel.OpenExcel(@res"Test.xlsx",True,"Excel","","")
Excel.RefreshPivotTables(objExcelWorkBook,"Sheet1")
TracePrint "Insert Row: PivotTable in Sheet1 Sheet of Excel Object"
Excel.CloseExcel(objExcelWorkBook,True)