CreatePivotTable method fails for data capture from external source

Corni

Active Member
Joined
Mar 2, 2002
Messages
328
I run an Excel data capture macro from an external source (cube) via a VB script. The script creates an instance of Excel opens PERSONAL.XLS and runs a macro from this file. All is nice but macro halts and generates a run time error '-2147417848(80010108)' Method 'CreatePivotTable' of object 'PivotCache' failed at the respective line of code from the following block:

With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
.Connection = _
"OLEDB;Provider=MSOLAP.2;Data Source=as3;Initial Catalog=IVR;Client Cache Size=25;Auto Synch Period=10000"
.CommandType = xlCmdCube
.CommandText = Array("Sales_Revenue")
.MaintainConnection = True
.CreatePivotTable TableDestination:="[" & strWkName & "]Sheet1!R3C1", TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion10
End With

But when enter the debug mode and hit F8 pivot table is created and can continue macro successfully. What is causing the generated error for the initial run and how can I avoid it to allow automated script to run?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,216,079
Messages
6,128,687
Members
449,464
Latest member
againofsoul

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