Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default PivotFilters in pivottable

I have created a pivottable in vba, here is the code for it:

Set pivotCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlExter nal)
pivotCache.Connection = Array("OLEDB;Provider=MSOLAP.4;Integrated
Security=SSPI;Persist Security Info=True;Initial Catalog=My Model 2008;Data
Source=mymachine;MDX Compatibility=1;Safety Options=2;MDX Missing Member
Mode=Error")
pivotCache.CommandType = xlCmdCube
pivotCache.CommandText = Array("Common Data Model")
pivotCache.MakeConnection
'pivotCache.MaintainConnection = True
Set pt = pivotCache.CreatePivotTable("Sheet4!R1C1",
TableName:="PivotTable1", DefaultVersion:=xlPivotTableVersion12)

I add pivotfields in pivottable in the following way:

Set cField = pt.cubeFields("[Store].[Store ID]")

cField.Orientation = xlRowField

but when i try to add a filter to the pivotfield i get an error
"Application-defined or object-defined error"
This is how I add filters
pf1.ClearAllFilters
pf1.PivotFilters.Add Type:=xlCaptionEquals, Value1:="0006"

Any idea what I am doing wrong?
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
Error Using the PivotFilters function jmlozares Excel Programming 2 July 21st 08 10:15 AM
Creating a PivotTable w/o selecting data in an existing PivotTable Damian Excel Discussion (Misc queries) 6 November 2nd 07 04:44 PM
How does one get the PivotTable report info that feeds another PivotTable report? Toby Erkson[_3_] Excel Programming 0 December 14th 04 10:00 PM
PivotTable - PivotTable Field name is not valid - error! miker1999[_17_] Excel Programming 1 June 10th 04 10:30 AM
Creating a PivotTable Report from an Another PivotTable Report bcpaulus Excel Programming 1 January 8th 04 07:56 PM


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

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"