CreatePivotTable fails with Error 1004 on excel 2010

hsenul

New Member
Joined
Jul 30, 2015
Messages
2
I have following macro code that works fine on excel 2007 however when I try this on excel 2010 it fails with error 1004 - Application-defined or object-defined error. This seems to be excel version specific but I am not sure what is the cause of this error.

Has anyone faced similar issues or any suggestions how to work around this problem?

<code>
With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
.Connection = "OLEDB;Provider=MSOLAP; Initial Catalog=[OCWCube]; CreateCube=CREATE CUBE [OCWCube] ( DIMENSION [sp3Code], LEVEL [All] TYPE ALL," _
& " LEVEL [sp3Code], LEVEL [Book], LEVEL [PL Cat], LEVEL [Sec], LEVEL [Nominal], DIMENSION [Source], L" _
& "EVEL [All] TYPE ALL, LEVEL [Source], LEVEL [Daz Item], MEASURE [DailyUSD] FUNCTION SUM ); InsertInto=INSERT INTO O" _
& "CWCube([Source].[Source], [sp3Code].[sp3Code], [Book], [Sec], [Nominal], [PL Cat], [Daz Item], SKIPONECOLUMN, [DailyUS" _
& "D]) OPTIONS ATTEMPT_ANALYSIS " _
& strSQL _
& "; Source_DSN=""DSN=MS Access Database;DBQ=" _
& shtStat.Range("statDB") _
& ";DefaultDir=c:\temp;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;"";"

.CommandType = xlCmdCube
.CommandText = Array("OCWCube")
.MaintainConnection = True
.CreatePivotTable TableDestination:=ActiveWorkbook.Worksheets("Dunzler").Cells(7, 2), TableName:="ptDazzler", DefaultVersion:=xlPivotTableVersion10
End With
</code>
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,214,784
Messages
6,121,538
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top