Run-time error '1004' Application-defined or object-defined error in Excel 2010 when pulling data from SSAS2005 cube

Lanscaping

New Member
Joined
Dec 16, 2011
Messages
5
When attempting to pull data out of SSAS2005 data cube on server into a pivot table on Windows desktop, I got this "Run-time error '1004' Application-defined or object-defined error" message. It happens everytime when I run this Macros. The section in red is the one the debug complaints. Any comment or feedback is welcomed.

Sub Macro1()
'
' Macro1 Macro
'
Workbooks("Book1").Connections.Add _
"Server-name Cube-name", "", Array( _
"OLEDB;Provider=MSOLAP.4;Integrated Security=SSPI;Persist Security Info=True;Data Source=Server-name;Initial Catalog= Data Catalog"), Array("Store"), 1
ActiveWorkbook.PivotCaches.Create(SourceType:=xlExternal, SourceData:= _
ActiveWorkbook.Connections("Server-name Store"), _
Version:=xlPivotTableVersion14).CreatePivotTable TableDestination:= _
"Sheet1!R1C1", TableName:="PivotTable1", DefaultVersion:= _
xlPivotTableVersion14
Cells(1, 1).Select

With ActiveSheet.PivotTables("PivotTable1").CubeFields( _
"[Store].[Store By Location]")
.Orientation = xlRowField
.Position = 1
End With
End Sub
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi and Welcome to the Board,

It's hard to replicate this without having access to a data cube.

On possible reason for the error is if you already have a "PivotTable1" in your Worksheet, it won't let you use that name for a new object.
 
Upvote 0
It worked after changing the sheet and table names to something else.
Thanks Jerry for your hint. Much appreciated!
 
Upvote 0

Forum statistics

Threads
1,215,427
Messages
6,124,831
Members
449,190
Latest member
rscraig11

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