View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
aamerrasheed via OfficeKB.com aamerrasheed via OfficeKB.com is offline
external usenet poster
 
Posts: 11
Default "Run-Time Error '1004'

Hi,
You can try changing ActiveWorkbook.PivotCaches.Add to ActiveWorkbook.
PivotCaches.Create


Fei wrote:
Hi all,

When I run my VBA, there was a message:

"Run-Time Error '1004':

The pivotTable field name is not valid. To create a pivottable report,
you must use data that is organized as a list with labeled columns. If
you are changing the name of a pivottable field, you must type a new
name for the field."

It occurred when running:
Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, _
SourceData:=PRange.Address)
Set PT = PTCache.CreatePivotTable(TableDestination:=shhet1. Range
("A1"), _
TableName:="PovitTable1")

Any help is appreciated

Fei


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200901/1