PivotTable error


#1

I have read all the forums on pivot table but I still do not understand how I can do it… I tried to implement the invoke code from Create Pivot table using UIPATH but I have encountered this error
image

is there something wrong with this code?
Dim oPivotCache As Microsoft.Office.Interop.Excel.PivotCache=Nothing
Dim oPivotTables As Microsoft.Office.Interop.Excel.PivotTables=Nothing
Dim oPivotTable As Microsoft.Office.Interop.Excel.PivotTable=Nothing

oPivotCache=CType(wb.PivotCaches().Add(Microsoft.Office.Interop.Excel.XlPivotTableSourceType.xlDatabase,rng),Microsoft.Office.Interop.Excel.PivotCache)
oPivotTables=DirectCast(p_ws.PivotTables(Type.Missing),Microsoft.Office.Interop.Excel.PivotTables)
oPivotTable=oPivotTables.Add(oPivotCache,p_rng,“Summary”,Type.Missing,Type.Missing)’


#2

Check this Create Pivot table using UIPATH


#3

thank you but I already did! I have downloaded the project you attached and it runs perfectly but when I went to replace the location of my file, the range, and the row to follow my excel but I encountered that error…


#4

Could you please attach your project file?