is possible to make a power view or power pivot using vba?

Hi,

How can i make a vba code to create a power view or power pivot in excel? The macro recorder don't do anything. Any idea?
LVL 1
joyacv2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

x-menIT super heroCommented:
ex.:

Sub PowerPivot()
    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
        "Sheet1!R1C1:R4C2", Version:=xlPivotTableVersion12).CreatePivotTable _
        TableDestination:="Sheet1!R1C4", TableName:="PivotTable1", DefaultVersion _
        :=xlPivotTableVersion12
    Sheets("Sheet1").Select
    Cells(1, 4).Select
End Sub
0
Zack BarresseCEOCommented:
@x-men: They're asking for a PowerPivot creation, not a PivotTable.

@joyacv2: You must be using Excel 2010, in which case no, there is no VBA object model for PowerPivot. This was added in Excel 2013, although it's somewhat limited. Here is an example ...
    Workbooks("Book1").Connections.Add2 Name:="LinkedTable_Table1", Description:="", ConnectionString:="WORKSHEET;Book1", _
                                        CommandText:="Book1!Table1", lCmdType:=7, CreateModelConnection:=True, ImportRelationships:=False

Open in new window


HTH
Regards,
Zack Barresse
0
joyacv2Author Commented:
so, there is no code to manipulate a power view or powerpivot, do you know any other alternative?
0
Zack BarresseCEOCommented:
As I said, if you're using 2010 there is no way to do this within Excel. Using 2013 there is an object model but it's not the most developed (since it's basically brand new). See http://msdn.microsoft.com/en-us/library/office/ff837594.aspx#xl15WhatsNew_NewDataSources

There is no object model for Power View.

Zack
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.