Automate Printing from a Pivot Table?

PolarBear

Board Regular
Joined
Sep 26, 2005
Messages
215
Hello,

I have a pivot table which shows sales data for a group of teams. I wanted a macro to print out a page for each team (the team name is up on the page level). So, using the macro record function, I stepped through the teams, and it generated the following (only showing 2 examples):

Sheets("DAILY TE- CUSTOMER").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Team").CurrentPage =
"John Jones"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Team").CurrentPage = _
"Mary Smith"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

When I tried to run it, I got an error message "Syntax error" for line 2 (ActiveSheet.PivotTables... etc.)

Any thoughts as to what might be wrong?

Thanks,

Kevin
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
THIS IS A DUPLICATE POSTING
******************************
It is not necessary, and frowned upon.
*******************************
It can waste a lot of our time by putting answers to questions already complete, as well as splitting a thread into several parts so people searching only get part of the picture.

You can see that your message has been read several times.
If you do not get an answer in a day or so, bring your message back to the top by adding a reply.

We habitually go back several days checking messages with no reply. This site makes it especially easy to do so.

If you have not got an answer by then you may need to change it to be shorter, or more understandable. In your case here it is OK.
See my reply there.
 
Upvote 0

Forum statistics

Threads
1,225,489
Messages
6,185,284
Members
453,285
Latest member
Wullay

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