An Area object representing the new data source in the same workbook.
Remarks
Example
Code Block
csharp
csharp
title
C#
Area newArea = worksheet.CreateArea("A1:C7");
pivotTable.ChangeDataSource(newArea);
Code Block
vbnet
vbnet
title
vb.net
Dim newArea As Area = worksheet.CreateArea("A1:C7")
pivotTable.ChangeDataSource(newArea)
Exceptions
Exception
ArgumentException
ArgumentException
If a null reference is passed in as parameter instead of a valid Area object, or if the new data source is not in the same workbook, or if not all the cells in the first row of the new area contain a value for the column name, then an exception of type ArgumentException will be thrown.