ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Extracting data from external pivot table - Office 2007 (https://www.excelbanter.com/excel-programming/433143-extracting-data-external-pivot-table-office-2007-a.html)

omsoft

Extracting data from external pivot table - Office 2007
 
I have several Excel files, each of which are over 70MB xlsm files.
I need to get some data from the pivot tables in the above-mentioned files
based on specified file and other criteria in pivot table.

Does somebody know how to do this in VBA? I get error 1004 at set pt = line.
I know the line below it is wrong. But that is a moot point, since i can't
get to it.

I tried the following code but it does not work.

rangeAddr = "'" & filePath & "[" & FileName & "]" & sheetName & _
"'!A4"
Set pt = Range(rangeAddr).PivotTable
Worksheets("Sheet1").Range(Cells(i, j), Cells(i, j)).Value = _
pt.GetPivotData("Quantity", rangeAddr, "Transaction Type", _
Worksheets("Sheet1").Range(Cells(1, j), Cells(1, j)), "Chain Code", _
Worksheets("Sheet1").Range(Cells(2, j), Cells(2, j))).Value

Thanks much.


All times are GMT +1. The time now is 02:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com