• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA to check if PowerPivot is installed

Vivek D

Member
I have a dashboard built on top of a Power Pivot model. Since it will only work if the user has Power Pivot installed, I want to check if PowerPivot is installed and if not, present a sheet with the link and instructions to install PowerPivot to the user.

Is there an easy way to do that?
 
Actually, I did look at that but somehow overlooked the solution provided after I saw the X86 and amd64 etc thinking it was some complicated solution. Isn't too bad though. Will give it a try.
 
A little simplified version to check !

Code:
Function PPcheck() As Boolean

Const checkFile As String = "Microsoft Analysis Services\AS Excel Client\10\Microsoft.AnalysisServices.Modeler.FieldList.dll"
Const dirx86 As String = "C:\Program Files (x86)\"
Const dirx64 As String = "C:\Program Files\"

If (Len(Dir(dirx64 & checkFile)) + Len(Dir(dirx86 & checkFile))) > 0 Then PPcheck = True

End Function
 
Although the code itself is good, the check kind of fails because the file being checked for is not present for me even though I have Power Pivot installed.

I instead have the file below (probably because I have Excel 2013 installed too)
C:\Program Files (x86)\Microsoft Office\Office15\ADDINS\PowerPivot Excel Add-in\PowerPivotExcelClientAddIn.dll

I also checked with my colleague who has Excel 2010 only but he didn't have the Microsoft.AnalysisServices.Modeler.FieldList.dll file or the one I had.

I suppose the Power Pivot dll itself has changed between versions and given different folks may have different versions installed, this kind of check may ont work out, unless I can somehow find out all possible locations.

Is there a different method.. maybe by checking the ribbon to see if the PowerPivot menu exists?
 
Is there a different method.. maybe by checking the ribbon to see if the PowerPivot menu exists?
I think it may be the good point to start ..
 
I started to explore the menu route but couldn't find the Power Pivot menu item. My VBA skills are pretty minimal though so someone with better skills and understanding of the object model may be able to figure this out.
 
Hi Vivek ,

I doubt that the Ribbon is a part of the Excel object model ; it is associated with XML , and this is not as simple as VBA.

Narayan
 
K.

When a user tries to use a power pivot based report without having power pivot installed, it throws an error saying "Initialization of data source failed..".
Is there a way to piggyback on that, catch the error and modify the message saying "You do not have Power Pivot installed.Please install....".
 
Hi Vivek ,

It should be possible using an On Error statement.

Find out the error number , and use an IF statement within the error handler to say If Err.Number = error number Then MsgBox ....

Narayan
 
Hi Vivek ,

Not an event ; use the On Error statement within the code which generates the Power Pivot report , so that if Power Pivot is not installed , the code exits with an informative message to the user.

Narayan
 
Found an other solution, which works on the german version and should work on the english version too:

Code:
Sub PPcheck()

Dim dirx As String
Dim checkfile As String

checkfile = "\Addins\PowerPivot Excel Add-in\PowerPivotExcelClientAddIn.dll"
dirx = Application.Path


If (Len(dir(dirx & checkfile))) > 0 Then MsgBox "OK"

End Sub

Could someone check this on an english version?
 
Back
Top