0

I have a macro running in an Excel 2011 workbook that is manipulating a pivot table in an Excel 2003 book. So far I haven't add issues with adding or hiding fields.

I'm trying to add a calculated field (as here - http://msdn.microsoft.com/en-us/library/ff834479(v=office.14).aspx) and it is not working.

ws.PivotTables("RetailerMgmt").CalculatedFields.Add "ASP", " = TYDSMTD/TYUSMTD", FALSE

Gets me Error 450 - Wrong number of arguments or invalid property assignment.

When I recorded the same task, the result was:

ExecuteExcel4Macro "(""RetailerMgmt"",1,""ASP"",""=TYDSMTD/TYUSMTD"",TRUE)"

Which was recorded and saved in the 2003 file, so I'm sure it's some Excel 2003 business (doesn't work when run from 2011).

So, is there any way to add a calculated field to a pivot table in a 2003 workbook from a macro being run in a 2011 workbook?

Thanks!

Community
  • 1
  • 1
ryantkelly
  • 93
  • 1
  • 9

1 Answers1

0

I ended up finding it easier to just save my source data book as an .xlsx file within the macro, then dealing with it from there.

ryantkelly
  • 93
  • 1
  • 9