Скрипт, чтобы проверить наличие PowerPivot и предложить пользователю установить - PullRequest
1 голос
/ 20 декабря 2011

Кто-нибудь видел скрипт для проверки надстроек пользователя для PowerPivot и предоставления пользователю диалогового окна для установки?

1 Ответ

1 голос
/ 20 декабря 2011

К сожалению, PowerPivot, по-видимому, не указан в списке доступных надстроек, доступном для VBA.

Возможно, вы хотели бы попробовать это:

Sub installPowerPivot()
If Not isPowerPivotInstalled Then
    MsgBox "PowerPivot is not installed on this machine." & vbCrLf & vbCrLf & _
        "Please visit this website to download the PowerPivot add-in:" & vbCrLf & _
        "http://powerpivot.com"
End If
End Sub


Function isPowerPivotInstalled() As Boolean
Const checkFile As String = "\Microsoft Analysis Services\AS Excel Client\10\Microsoft.AnalysisServices.Modeler.FieldList.dll"
Dim tempFSO As Object
Set tempFSO = CreateObject("Scripting.FileSystemObject")

'check x86 program files folder
If tempFSO.fileexists(Environ("ProgramFiles(x86)") & checkFile) Then
    isPowerPivotInstalled = True
    Exit Function
End If

'if it's a 64bit machine also check the 64bit program files folder
If LCase(Environ("processor_architecture")) = "amd64" Then
    If tempFSO.fileexists(Environ("ProgramW6432") & checkFile) Then
        isPowerPivotInstalled = True
        Exit Function
    End If
End If

'if both checks fail -> false
isPowerPivotInstalled = False
End Function
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...