Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PasteSpecial Method Error PW11111 Excel Discussion (Misc queries) 1 December 19th 06 01:24 PM
Show method (Error 438) Lee Excel Programming 2 April 5th 05 06:15 PM
Error 424 with inputbox method after OK Herman[_4_] Excel Programming 1 September 14th 04 11:12 PM
Runtime Error '1004' - AddFields method of PivotTable class failed MikeC[_3_] Excel Programming 1 May 21st 04 06:58 AM
Using Add Method of QueryTables gives error Shilps Excel Programming 1 April 22nd 04 03:49 PM


All times are GMT +1. The time now is 09:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"