Search code examples
excelvb.netpivot-tableexcel-interoplate-binding

Using VB.NET to create a Pivot Table on an Exported Document


I have a pipe-delimited text file that I need to read, turn into a pre-formatted Excel document - complete with separate pivot table sheet - and save.

Reading the file and saving it as an Excel document are solved, but I can't seem to get the pivot table to work. I've found a variety of tutorials online, but none are actually working for me.


Solution

  • I ended up accomplishing this by changing the problem line to the below.

    Dim Table As Excel.PivotTable = xlPivotSheet.PivotTableWizard(Excel.XlPivotTableSourceType.xlDatabase,
     Range,Location, "Title Here",True, True, True, False)