Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
addfields method error
my problem is similar to the one reported on 6/22. the 6/22 comment did not
seem to resolve the issue. i built a pivot table normally and everything worked. i then recorded an excel macro, whereby i build the same pivot table. during the recording everything worked. when i try to run the macro, i get a run time error 1004 - addfields method of pivottable class failed. this makes no sense, in that, if it worked without recording, why should it not work after recording. do not see anything wrong in the code, matches exactly to what is the help area or textbooks. why the error? i have included that is used Sub freqers() ' ' freqers Macro ' Macro recorded 8/31/2005 by jnewland ' ' Rows("1:2").Select Selection.Delete Shift:=xlUp Cells.Select ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _ "freqers!C1:C11").CreatePivotTable TableDestination:="", TableName:= _ "PivotTable1", DefaultVersion:=xlPivotTableVersion10 ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1) ActiveSheet.Cells(3, 1).Select ActiveSheet.PivotTables("PivotTable1").AddFields RowFields:=Array( _ "IPA and Product", "Group number and name") With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Allowed total") .Orientation = xlDataField .Caption = "Sum of Allowed total" .Function = xlSum End With Range("A7").Select Selection.Delete Columns("A:A").ColumnWidth = 31 Columns("A:A").ColumnWidth = 43.43 Columns("A:A").ColumnWidth = 52.86 ActiveWorkbook.ShowPivotTableFieldList = False ActiveWorkbook.SaveAs Filename:= _ "E:\adhoc_team\jnewland\erfreqflyer\July's data\freqers2.xls", FileFormat:= _ xlExcel9795, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _ False, CreateBackup:=False ActiveWorkbook.Close End Sub it abends at the addfields rowfields line each time. i have several macros that worked under office 97, but now that we have switched to office 2003, macros do no work. therefore, need to find out why failing, so get 45 macros back in operation thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
PasteSpecial Method Error | Excel Discussion (Misc queries) | |||
Show method (Error 438) | Excel Programming | |||
Error 424 with inputbox method after OK | Excel Programming | |||
Runtime Error '1004' - AddFields method of PivotTable class failed | Excel Programming | |||
Using Add Method of QueryTables gives error | Excel Programming |