Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Pivot Table version (xlPivotTableVersion12)

Hi, I'm trying to create a macro that will create a pivot table connected to
an OLAP cube (ie foodmart).

Very simple steps, record a macro that inserts a pivot table in a Sheet and
connects to an external data source, ie food mart. Drop some fields into the
report filter, stop recording and run it. The VBA code looks like this:

With ActiveWorkbook.PivotCaches.Create(SourceType:=xlEx ternal)
.Connection = Array( _
"OLEDB;Provider=MSOLAP.2;Persist Security Info=True;User
ID=abanica;Data Source=banica;Initial Catalog=FoodMart 2000;Client Cache
Size=" _
, "25;Auto Synch Period=10000;MDX Compatibility=1")
.CommandType = xlCmdCube
.CommandText = Array("Budget")
.MaintainConnection = True
.CreatePivotTable TableDestination:="Sheet5!R3C1", TableName:= _
"PivotTable2", DefaultVersion:=xlPivotTableVersion12
End With

I will receive : "Run-time error '1004'. The parameter is incorrect."

Now, programatically I'm creating a pivot table : (please change the
connection string...)

Microsoft.Office.Interop.Excel.PivotCache pv =
wb.PivotCaches().Add(Microsoft.Office.Interop.Exce l.XlPivotTableSourceType.xlExternal, Type.Missing);
pv.Connection = "OLEDB;Provider=MSOLAP;" + loc[0].ToString()
+ ";Initial Catalog=" + result.Catalog;
pv.CommandType =
Microsoft.Office.Interop.Excel.XlCmdType.xlCmdCube ;
pv.CommandText = result.Cube;
pv.MaintainConnection = true;

Microsoft.Office.Interop.Excel.PivotTable pt =
(PivotTable)pv.CreatePivotTable(ws.get_Range("B1, "B2"), "MainPivot", true,
XlPivotTableVersionList.xlPivotTableVersionCurrent );


This code works but the pivot table version will be "xlPivotTableVersion10".
As soon as I'm trying to change the XlPivotTableVersionList to
xlPivotTableVersion12 an error occurs.

Anyone has any ideas?
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
how to create pivot table from existing pivot table in excel 2007 Udayraj Dhulekar Excel Discussion (Misc queries) 2 July 8th 13 08:22 PM
Pivot version issue-riv Rivers Excel Discussion (Misc queries) 0 July 24th 08 12:27 AM
error in Pivot table in different language version jiang Excel Discussion (Misc queries) 1 January 24th 07 10:06 AM
pivot table version issue maryj Excel Discussion (Misc queries) 1 October 4th 05 07:40 PM
How can I insert an undo button in the Web version of the Pivot Ta Martin sirois Excel Discussion (Misc queries) 0 April 10th 05 02:09 AM


All times are GMT +1. The time now is 08:18 PM.

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"