Extracting data from external pivot table - Office 2007

O

omsoft

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top