Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default "Unable to get Pivot Tables Property of Worksheet Class "Error

I am trying to run a PIvot table macro and when I run it, I get Error
1004. However, whenever I run the same macro step by step(using F8),
it works fine . Here is the macro code..

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
"'WOH details'!A:S").CreatePivotTable TableDestination:= _
"WOH!R3C1", TableName:="WOHPivot", DefaultVersion:= _
xlPivotTableVersion10
ActiveSheet.PivotTables("WOHPivot").AddFields RowFields:="Owner Name",
_
ColumnFields:="Case Calendar Age Bucket-Hrs",
PageFields:=Array( _
"Owner Work Group", "Case Priority")
ActiveSheet.PivotTables("WOHPivot").PivotFields("C ase Id").Orientation
= _
xlDataField
ActiveWorkbook.ShowPivotTableFieldList = True

Any help in this regards is greatly appreciated

  #2   Report Post  
Posted to microsoft.public.excel.programming
dq dq is offline
external usenet poster
 
Posts: 46
Default "Unable to get Pivot Tables Property of Worksheet Class "Error

Hi

Everything works fine when I try it. What is the exact errormessage
you get.
Usualy with this type of errors it is because your code depends on the
active sheet being 'WOH' and perhaps it isn't when you run the
macro...
Perhaps if you change it to

With ActiveWorkbook.PivotCaches.Add(xlDatabase, "'WOH details'!
A:S").CreatePivotTable("WOH!R3C1", "WOHPivot", ,
xlPivotTableVersion10)
.AddFields RowFields:="Owner Name", ColumnFields:="Case Calendar Age
Bucket-Hrs", PageFields:=Array("Owner Work Group", "Case Priority")
.PivotFields("Case Id").Orientation = xlDataField
End With
ActiveWorkbook.ShowPivotTableFieldList = True

then it does't matter wich sheet is active.

DQ

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default "Unable to get Pivot Tables Property of Worksheet Class "Error

Thank you very much !!

I made the changes and on initial testing it seems to work...

If I have any further problems, I will respond back.

Really appreciate the excellent rapid response, :-)

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
"Unable to get the VLookup property of the WorksheetFunction class Ayo Excel Discussion (Misc queries) 4 August 6th 08 10:00 PM
Hiding Rows Error - "Runtime Error 1004 - Unable to set the hidden property of the range class" Punsterr Excel Programming 2 April 9th 07 05:32 PM
Interop - "Unable to set the Color property of the Interior class" Elsa Excel Programming 2 August 23rd 06 04:57 AM
"Unable to set the Formula property of the Series class" with a tw PeterQ Charts and Charting in Excel 1 February 15th 06 07:37 PM
"Unable to get the Pivotfieldsd property of the Pivot Class" twaccess[_21_] Excel Programming 1 July 8th 05 01:42 PM


All times are GMT +1. The time now is 07:08 AM.

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

About Us

"It's about Microsoft Excel"