Excel 2007: Pivot tables "Invalid procedure call or argument"

P

Paul Martin

Hi all

I'm having problems with pivot tables and coding that worked fine in
XL03 but is failing in XL07. My code fails when I attempt to set the
CurrentPage. I can manually change the CurrentPage to the value that
my code is attempting, and then the code works. I can manually change
the CurrentPage back again to its original value and the code works
again. It makes no sense why it's not working.

The line of code failing is this:

pt.PivotFields("Month").CurrentPage = CStr(12)

Thanks in advance

Paul Martin
Melbourne, Australia
 
B

Boris Geissler

Try the following:

pt.PivotFields("Month").CurrentPage = CStr(12) & Chr(0)
 

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