# PivotTable error

**URL:** <https://forum.uipath.com/t/pivottable-error/56599>\
**Category:** Help\
**Tags:** excel, system, activities\
**Created:** [August 10, 2018, 2:30am UTC](https://forum.uipath.com/t/pivottable-error/56599 "2018-08-10T02:30:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![qaz1](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/qaz1/32/263941_2.png) [@qaz1](https://forum.uipath.com/u/qaz1)\
**Post date:** [August 10, 2018, 2:30am UTC](https://forum.uipath.com/t/pivottable-error/56599/1 "2018-08-10T02:30:50Z")

</div>

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 - #3 by sanjay21051990](https://forum.uipath.com/t/create-pivot-table-using-uipath/11799/3) but I have encountered this error

 ![image](https://global.discourse-cdn.com/uipath/original/3X/f/4/f4def2aab9ec1172b0ab40577fcc0a6203182d62.png)

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)’

---

<div class="post-metadata">

**Author:** ![sanjay21051990](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sanjay21051990/32/24979_2.png) [@sanjay21051990](https://forum.uipath.com/u/sanjay21051990)\
**Post date:** [August 10, 2018, 6:05am UTC](https://forum.uipath.com/t/pivottable-error/56599/2 "2018-08-10T06:05:15Z")

</div>

Check this [Create Pivot table using UIPATH - #3 by sanjay21051990](https://forum.uipath.com/t/create-pivot-table-using-uipath/11799/3)

---

<div class="post-metadata">

**Author:** ![qaz1](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/qaz1/32/263941_2.png) [@qaz1](https://forum.uipath.com/u/qaz1)\
**Post date:** [August 10, 2018, 6:08am UTC](https://forum.uipath.com/t/pivottable-error/56599/3 "2018-08-10T06:08:55Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![terrygu0913](https://avatars.discourse-cdn.com/v4/letter/t/e79b87/32.png) [@terrygu0913](https://forum.uipath.com/u/terrygu0913)\
**Post date:** [August 10, 2018, 6:33am UTC](https://forum.uipath.com/t/pivottable-error/56599/4 "2018-08-10T06:33:42Z")

</div>

Could you please attach your project file?
