Selecting values in the page field of a pivot table

M

matpj

Hi,

I have a spreadsheet that has a pivot table on it.
If I right-click and refresh, it seems to refresh without error.


if I try to refresh it with VBA using ths code:
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh

I get the error:
"Run time error 1004: [Microsoft][ODBC Access Driver] The connection
for viewing your linked Microsoft Excel worksheet was lost"



ALSO if I try to use VBA to select from the page field drop down using
this code:

ActiveSheet.PivotTables("PivotTable1").PivotFields("FOB").CurrentPage =
"hdw"

(i'm trying to select hdw from the page field drop down)

the error I get is:
"Unable to set the _Default property of the PivotItem Class"

can anyone help?
when I do these manually I don't get any errors.

thanks,
Matt
 

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