Runtime error '1004': Unable to get the Pivot Tables propert

susant_sabat

New Member
Joined
Nov 16, 2005
Messages
1
Hi,

I am getting a run time error '1004': Unable to get the Pivot Tables property of the Worksheet class' while running the following code:

Sub Auto_Open()

Application.DisplayAlerts = True


Application.DisplayAlerts = True
ChDir "F:\Project\Workarea\Susant\Documents\Work\ADIINFDP\DSPS Reporting\#Reporting"
Workbooks.Open Filename:="F:\Project\Workarea\Susant\Documents\Work\ADIINFDP\DSPS Reporting\#Reporting\xxxDSPSprods.xls"
Cells.Select
Selection.Copy
Workbooks.Open Filename:="F:\Project\Workarea\Susant\Documents\Work\ADIINFDP\DSPS Reporting\#Reporting\DSPSprods.xls"
Sheets("DSPSprods").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Strategies by Generic").Select
Range("A2").Select
Application.CutCopyMode = False
ActiveSheet.PivotTables("PivotTable9").RefreshTable
Sheets("DSPSprods").Select
Range("A1").Select
ActiveWorkbook.SaveAs Filename:="F:\Project\Workarea\Susant\Documents\Work\ADIINFDP\DSPS Reporting\#Reporting\DSPSprods.xls"
ChDir "F:\Project\Workarea\Susant\Documents\Work\ADIINFDP\DSPS Reporting\Diane Reports"
ActiveWorkbook.SaveAs Filename:= _
"F:\Project\Workarea\Susant\Documents\Work\ADIINFDP\DSPS Reporting\Diane Reports\DSPSprods.xls"
ActiveWorkbook.Close
ActiveWorkbook.Close

Kindly let me know if you find the reason and remedy for such an error. Any pointers will also be helpful.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
That line of code is correct.

Need to first check that the active sheet is the one containing the pivot table.

Then check the pivot table name is correct (right click the table then 'Options'.
 
Upvote 0

Forum statistics

Threads
1,215,743
Messages
6,126,615
Members
449,322
Latest member
Ricardo Souza

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top