VB.NET - how to fix error ex.Message = "The PivotTable field name is not valid. To create a PivotTable report, you must use data that is organized as a list with labeled columns. If you are changing the name of a PivotTable field, you must type a new name for the field."
Most likely range is incorrect
Dim xlRange As Excel.Range = CType(osheet, Excel.Worksheet).Range("A1:D20")
Change to (for instance)
Dim xlRange As Excel.Range = CType(osheet, Excel.Worksheet).Range("A1:B10")
No comments:
Post a Comment