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)
 
Top